Shirt Pocket Discussions

Shirt Pocket Discussions (https://www.shirt-pocket.com/forums/index.php)
-   General (https://www.shirt-pocket.com/forums/forumdisplay.php?f=6)
-   -   How to preserve icon of target volume during smartbackup? (https://www.shirt-pocket.com/forums/showthread.php?t=872)

mypointofview 12-02-2005 02:53 PM

How to preserve icon of target volume during smartbackup?
 
I've set up a personalized script, so that the invisible file ".VolumeIcon.icns" should be ignored on the original drive while running "Backup - all files" in Smart Update mode. This works and the target volume does not receive this icon :)

However, in the same script I have defined also that the icon for the target drive "Volumes / BKUP Macintosh HD / .VolumeIcon.icns" should also be ignored. Yet it gets deleted on the target volume when I do a smart backup :(

I had selected the icon for the original drive ".VolumeIcon.icns" from the first column in the little browser underneath the "Script Commands" pane.

The icon for the target drive "Volumes / BKUP Macintosh HD / .VolumeIcon.icns" I had selected by first clicking on "Volumes" (left column) which then revealed all mounted drives in a second column. There I selected my target drive, which opened a third column where I finally selected the icon file for the target drive.

So the pane of the scripts commands said:

ignore .VolumeIcon.icns
ignore Volumes/BKUP Macintosh HD/.VolumeIcon.icns

Question: why is the icon on my target volume being deleted and how can I stop this?


Sincerely, Martin.

Panther 10.39, G4 Dual 500, SuperDuper 2.0, all internal drives

dnanian 12-02-2005 03:33 PM

1 Attachment(s)
By definition, ignore with Smart Update will remove the file. It's ignored *from the source*, not the destination. That means it's not in the set of files to be copied, so it'll be removed instead.

So, here's what you should do:

- Create a folder named "Volume Icons" in your Home.
- In there, place the icon you want, for a given volume, named "the-volume-name.VolumeIcon.icns".
- Download the attached and set it as your "after copy" script in Advanced

That'll automatically set the icon when the backup is done. Note that it depends on having the developer tools installed in most cases (unless the source has a custom icon).

Aristophanes 01-17-2006 03:30 AM

Altered Icon on Cloned Drive
 
Hello,

I have the same problem of my cloned drive icon changing after every backup. It is very frustrating. :(

Unlike the previous questioner, I have done nothing to exempt any files. SuperDuper just started doing it. This did not happen under V.1.

Thanks

dnanian 01-17-2006 08:31 AM

This behavior hasn't changed between v1 and v2, Aristophanes. The icon is a file like any other, and is copied from the source to the destination.

There's a message "stuck" at the top of the forum that provides a method that should let you reset the icon after you back up, should this be important to you.

aaronpcreative 02-04-2006 07:14 PM

New Icon doesn't show up until log out/in
 
I followed all the steps above, and it works great except for the fact that the icon doesn't refresh automatically.

Let me suggest a feature here- that it would be nice to have the option, while setting up a dupe, to overlay a tiny indicator to the target volumes' duplicated icon, after copy, so that people wouldn't have to mess with .icns files? I do icons for fun so it's no big deal for me, but when you have several volumes operating, it can get a bit confusing in the finder.

dnanian 02-04-2006 09:42 PM

I'm not sure what you mean, Aaron. Where is this indicator displayed?

aaronpcreative 02-05-2006 03:00 PM

Just like there is an icon overlay in the Dock when you get mail. Perhaps the pencil from your logo would overlay the cloned drive's icon to visually reinforce that it's a backup. It wouldn't have to be dynamic, though. Just a thought, really. I don't have any idea how difficult that would be to accomplish.

Now, about the current issue of the icon not appearing until I log out then log back in. Any ideas? Thanks.

dnanian 02-05-2006 03:11 PM

Unfortunately, doing that would require dynamically modifying the icon itself; mail does it because it owns its dock icon, but we'd have to go behind Finder's back. I'm not sure that's really practical.

Regarding the icon -- try relaunching Finder by Option-Control-Clicking its dock icon and choose "Relaunch".

jwheare 04-21-2006 05:17 PM

Is there no way to reset the volume icon via the script? Seems a bit of a kludge to have to relaunch the Finder.

A better solution to this issue would probably be an option to ignore specific files on the target volume.

Thanks for this interim solution :)

dnanian 04-21-2006 05:20 PM

Well, the icon does reset in the script, but it seems to be that killing and restarting the Finder on the user is kind of unclean. It'd probably be better for the Finder to get fixed... ;)

jwheare 04-21-2006 05:22 PM

Probably but what are the chances of that?

Yeah yeah, bug report yada yada ;)

jwheare 04-21-2006 06:56 PM

Alternatively, what's the best way to safely unmount/remount the volume via the shell script? umount yielded slightly scary results when I tried it in the terminal.

Cheers.

dnanian 04-21-2006 07:40 PM

You can unmount/remount using the same general script that you'll find elsewhere on the forums (where it's used during scheduled backups). Basically, you use diskutil...

mypointofview 05-22-2006 08:48 PM

How to exclude the desktop picture from a backup?
 
I'd like to continue the discussion in this thread towards talking about the desktop image. The real reason for people wanting to have a different icon on their backup drive is, i guess, to not get fooled. Because the backup is a duplicate and looks the same.

When I troubleshoot a computer problem or wander on my backup for other reasons I find myself often forgetting that I'm actually on a backup :o

Therefore I like to have a different desktop picture on my backup drive - automatically.

How to do this? I believe the procedure is similar as with the volume icon, but I don't know which files to exclude for this - perhaps some Preference file?

Here's an crazy idea: how about if SuperDuper overlays the backup desktop automatically with a "SuperDuper!" logo/desktop? I could then always change that easily if I'd wanted to continue "living" on that backup volume...

Sincerely, Martin.

dnanian 05-22-2006 09:06 PM

This wouldn't be that easy to do, Martin... I'm also not so sure I would *want* to modify a backup for something like this.

That said, it's possible you could have a regular picture you're using for the desktop image, and then change that file (same name) with another one in a post-copy script...

mypointofview 05-23-2006 06:03 PM

I'm ready to try the postscript technique now.

Because the following did not work: place a different picture with the same name, same access date, same modification date and same creation date into the same directory in the target volume.

SuperDuper! did overwrite it!

Actually this was a correct action, because there was a difference -- the file size. Yet all this is not so easy to understand. :cool:


Sincerely, Martin.

mypointofview 05-23-2006 08:38 PM

I have now tried to run a shell script after backup to create an icon on the target drive but it did not work. Here's what I did:

1. I downloaded the shell script (can't remember - it was on this forum, perhaps this thread). It shows up on my computer as a UNIX deamon (brownish rectangle) and it's called set_icon (no suffix). I opened it with BBEdit out of curiosity and it says:

PHP Code:

#!/bin/sh
echo "Restoring icon for $3..."

if [ -e $HOME"/Volume Icons/$3.VolumeIcon.icns" ]; then
 cp $HOME
"/Volume Icons/$3.VolumeIcon.icns" "$4/.VolumeIcon.icns"
 
/Developer/Tools/SetFile -a C "$4"
fi 

2. I got an icon from my Pixadex collection where I did an export as ICNS. I created a folder named Volume Icons inside my Home Library folder (to have it in a safe place). The icon I renamed as the-volume-name.VolumeIcon.icns - in my case G4 Factory.icns.

3. I launched SuperDuper! and called up my favorite Backup copy script Backup - all files (no HD icon) which is a slightly modified script that will ignore the files Icon and .VolumeIcon.icns from the top level of the master volume.

4. I went into Options > Advanced and checked the box "Run shell script...". Then I clicked the button "Choose" next to it and selected the set_icon shell script described above.

5. I did the Backup - all files (no HD icon).

6. Upon completion the new icon was not there. I looked at the volume also via Get Info in case the finder window had not been refreshing but it was just the generic drive icon.

Questions: Since I followed essentially the instructions... how do I know if I have the developpers tools installed? And: did I place the icon into the right place so that the script could actually be able to find it?

Thanks Dave for all your support. I have zero clou about Shell scripts :confused:

Sincerely, Martin.

dnanian 05-23-2006 08:48 PM

Two things to check. First, log out and back in, and tell me if the icon is there.

If not, check to see if you have a "Developer" folder at the top of your drive. If not, use your Tiger disks to install them. Then, give it another try.

mypointofview 05-25-2006 09:24 PM

The icon did not show. Also I don't have the developpers folder on the top level of my drive. So it did not work because that's what was missing.

So I then went ahead and started installing XCode from the Tiger install DVD -- but hey, it wants to install 1.5 GB :eek: ...

Thanks Dave, but I guess I rather use that space for some cool movie or music (unless you have a trick for me - could I install just a component of XCode perhaps? or is it one of the other "packages"?)

... gosh, what a fuzz just to get an icon excluded from a backup!

Sometimes I therefore really think very nicely about SynchronizePro! which I used to run on OS9 ... I mean for those type of things like icon or desktoppicture.

On the other hand I really prefer SuperDuper! because of its iTunes style charm - and support ;)

dnanian 05-25-2006 09:33 PM

The specific program needed is "SetFile", but I don't know what else it depends on. But you could use Pacifist or its equivalent to extract it and put it in /Developer/Tools.

mypointofview 05-31-2006 05:13 PM

How to set icon on target disk
 
I got it to work :)

My goal was to not have a folder called "Volume icons" on the top level of my home folder. Also I did not want to have that "Developer" folder with 70MB of stuff on the root level of my drive.

Here's what I did:

1. From the Tiger install CD I installed the so-called "Developer Tools". It is not necessary to install that huge XCode package. The Developer Tools install "only" about 70 MB.

2. Once installed, I navigated to /Developer/Tools/SetFile. I put this piece called "SetFile" (looks like a dark brown Unix deamon) into my own directory (the tilde ~ stands for my user name): ~/Library/SuperDuper!/DeveloperTool/. I had to create the folder "SuperDuper!" inside my Library and in there I created the folder "DeveloperTool" (write without space!) where I then put the "SetFile" piece. Attention: "SetFile" must live in a folder without spaces in its name! In other words, from the whole Developer Tools installation you only need that one little piece called "SetFile".

3. I then created the folder ~/Library/SuperDuper!/Shell script/. Into that folder I copied the script "set_icon" which Dave posted in this thread.

4. I created the folder ~/Library/SuperDuper!/Volume icones/. Into that folder I exported from Pixadex some nice icons as ICNS. I don't know how to do it without Pixadex, but if you're into icons you probably have that app. The icon must have the name of the backup target volume in it's name. Like so: xxxxxxx.VolumeIcon.icns (xxxxxxx must be replaced with the actual name of your target volume which you choose as "to" volume in SuperDuper!)

5. Now the customization of the shell script "set_icon". I changed the file path in Dave's code in three places. One file path is now correctly pointing to the "SetFile" piece in MY folder structure. Note that I placed "$HOME" in front of the file path so that it can be found in MY Library folder. The other two file paths are also now correctly pointing to my icons. Here's the adapted code. So if you can't find Dave's script, just copy and paste the code below into a text editor and save it with the name set_icon.

PHP Code:

#!/bin/sh
echo "Restoring icon for $3..."

if [ -e $HOME"/Library/SuperDuper!/Volume Icons/$3.VolumeIcon.icns" ]; then
 cp $HOME
"/Library/SuperDuper!/Volume Icons/$3.VolumeIcon.icns" "$4/.VolumeIcon.icns"
 
$HOME/Library/SuperDuper!/DeveloperTool/SetFile -a C "$4"
fi 


6. Now setting up SuperDuper!. I clicked Options and then Advanced. I checked the last box "Run shell script..." Then click on "Choose". I navigated to ~/Library/SuperDuper!/Shell script/set_icon

I could now trash the whole Developer folder on the root of my drive - I think. Because the most important piece ("SetFile") is now in my own structure. I still have that Developer folder on my drive as I'm writing this, so I don't know if that folder is really needed or not. But before I'd trash it I'd make a copy... ;)


That's it !

dnanian 05-31-2006 05:33 PM

Glad you were able to get to a solution you're happy with!

john love 07-23-2006 03:54 PM

Insufficient privileges to change icon???
 
Reference script to change icon after smart update

the first 2 lines of your script are:

#!/bin/sh
echo "Restoring icon for $3..."

SD chokes on the 1st line because of insufficient permissions ... in this case the destination is a .dmg file which is located on the 1st of 2 partitions of an external drive and obviously I am the administrator.

My second smart backup will probably have the same problem because the destination is on the 2nd of 2 partitions of the same external drive.

Thanks, Dave

John Love

dnanian 07-23-2006 03:58 PM

That's because you haven't given the script execute permissions, John. So, in Terminal, you want to do:

chmod +x the-script-file

That should deal with it...

john love 08-02-2006 06:13 PM

Changing the icon on a sparseimage
 
Dave:

Thanks again for the chmod +x fix ... but:

(1) for the first scenario I have in my HOME folder this file = "VolumeIcons:LaCie SandBox.VolumeIcon.icns" whose icon is my special icon and this scenario works flawlessly once I did the chmod +x in Terminal.

(2) for the last scenario I have in the same HOME folder this file = "VolumeIcons:iMac_Internal_DU.VolumeIcon.icns" ... but for this scenario I save all files to a sparseimage file = "iMac_Internal_DU.sparseimage" which when double-clicked expands to "iMac_Internal_DU".

okay, when I run SD on #2, the icon of the original volume = "iMac Internal HD" (which is the same as for #1) gets transferred to "iMac_Internal_DU", that is, no special icon?????

HAALP!!

dnanian 08-02-2006 07:18 PM

Not quite sure why that would be, but I don't think I considered sparse images when I wrote this. Do you really need your sparse image to have a special icon when mounted, John?

john love 08-03-2006 10:21 AM

icon for sparseimage
 
No I do not need to simply because my sparseimage destination has a name (iMac_Internal_DU) that is not identical to the source (iMac Internal HD). I changed the name for the same reason that others have asked for a special icon to differentiate between the source and the destination.

The only reason for this question on sparseimages is strictly a academic curiosity.

Thanks.

dnanian 08-03-2006 10:24 AM

OK. Not sure why it wouldn't work, but I don't have enough time to do a thorough investigation at this moment... if I had to guess, the volume name isn't being passed through as expected, or is different than the name of the image, or something like that.

When I get a chance, I'll try to run this down....

john love 08-06-2006 02:53 PM

icon for sparseimage
 
The non-appearance of the new icon for the disk within the sparseimage is only temporary. This disk image with the wrong icon is still on the desktop ... when I eject the disk and then re-open the sparseimage, the new icon appears.

Not all wasted, however, because in the process of discovering this "feature" I developed a straight AppleScript to effect the same thing:

=====

-- "set_icon_scpt.scpt"
--
-- run after SuperDuper's 'Copy All Files to "iMac_Internal_DU"'

property theSrc : "iMac Internal HD"
property theDest : "iMac_Internal_DU"

property ICONS : "Volume Icons"
property theICON : ".VolumeIcon.icns"

copyAllFiles(theSrc, theDest)

on copyAllFiles(srcDisk, destDisk)

tell application "Finder"
activate

set destDMG to destDisk & ".sparseimage"

set iconFolder to folder ICONS in home
set newIconFile to document file (destDisk & theICON) in iconFolder

set restoreFolder to get original item of (item "Restore" in desktop)

open information window of newIconFile

tell application "System Events"
keystroke tab
keystroke "c" using command down

delay 0.2 -- a tad extra time for copying to complete
end tell

close front window -- info window of newIconFile

open document file destDMG of restoreFolder

repeat until exists disk destDisk
delay 0.2
end repeat

open information window of disk destDisk

tell application "System Events"
keystroke tab
keystroke "v" using command down

delay 0.2 -- a tad extra time for pasting to complete
end tell

close front window -- info window of destDisk

eject disk destDisk
end tell

end copyAllFiles

=====

The reason for the keystroke calls is that according to Apple's AppleScript forum http://bbs.applescript.net/, the:

get info for ...
set icon to icon of it

is broken; so the keystroke approach is necessary until Apple fixes this.

Before I go, is there a way to pass the srcDisk and destDisk parms from SuperDuper to the above AppleScript using $3 and $4, rather than my hard coding them?

***
***

john love 08-13-2006 01:48 PM

Pass the srcDisk and destDisk parms from SuperDuper's shell script to AppleScript
 
What I was trying to do initially was access within the shell script a specific handler in the AppleScript and that did not work for me.

Then I simply accessed the whole AppleScript from the shell script and within the AppleScript's on run handler accessed the specific handler ... and this worked.

After burrowing around Apple's AppleScript Bulleting Board , I found out how to pass parameters from within a shell script to an external AppleScript script ...

1) my shell script = "set_icon_shell_script.txt":

#!/bin/sh
echo "Restoring icon ..."

osascript ~/Library/Application\ Support/SuperDuper\!/Saved\ Settings/set_icon_applescript_from_shell.scpt "iMac Internal HD" "iMac_Internal_DU"

2) duped it (so I can retain the original .txt)
3) chmod +x on the copy within Terminal
4) changed the copy's suffix to .command as in "set_icon_shell_script.command"

Then I double-clicked the ".command" file, Terminal started up and it worked, as described below.

Next, is the AppleScript code:

on run parms
set theSrcDisk to item 1 of parms
set theDestDisk to item 2 of parms

copyAllFiles(theSrcDisk, theDestDisk)
end run

on copyAllFiles(srcDisk, destDisk)

-- code

end copyAllFiles

Anyway, it worked.

Just one thing is lacking ... above I have what I call the long-way-around path for the AppleScript file within my osascript call ...

This AppleScript file is in the same Folder as my shell script, yet just using:

osascript set_icon_applescript_from_shell.scpt parm1 parm2

generates "no such file" in the Terminal. ?????

Cheers! :)

John Love

dnanian 08-13-2006 03:15 PM

That's because the "current directory" isn't necessarily the location of the script. So, you'll really want to put the scpt somewhere you know (e.g. ~/bin) and reference it explicitly.

markstenton 08-31-2006 12:17 PM

fuzzy outline
 
Hi

I have been trying to get this work
Rather oddly the icon is restored after the backup, but seems to have a fuzzy outline. If I then click on the fuzzy harddrive icon it resorts to the generic yellow firewire drive icon.

have you any idea please what I have done wrong?

Thanks

Mark

dnanian 08-31-2006 12:26 PM

Hm. Are you sure the icns file was taken from an original, non-fuzzy version?

markstenton 08-31-2006 12:41 PM

Hi

Yes if do the whole process manually, using get info and copy and paste, the the icon looks perfectly Ok.

The other thing that happens is that if I try Get Info on the fuzzy file I cannot paste over the top of it - nothing happens!

dnanian 08-31-2006 12:42 PM

Right, but did you copy the original icns file from the destination's volume, after you'd pasted it in? And can you look at it in Preview and have it look correct?

Finally, do you have the developer tools installed?

DavidGG 09-19-2006 10:22 PM

Quote:

Originally Posted by dnanian (Post 4429)
- Create a folder named "Volume Icons" in your Home.
- In there, place the icon you want, for a given volume, named "the-volume-name.VolumeIcon.icns".
- Download the attached and set it as your "after copy" script in Advanced

I may be missing something here, but is there a reason why the user should be bothered with maintaining a "Volume Icons" folder? Wouldn't it be better to use a "before copy" script that saves the icon in /tmp, and an "after copy" script that restores it later?

# Save volume icon
if [ -e "$4/.VolumeIcon.icns" ]; then
cp "$4/.VolumeIcon.icns" "/tmp/$3.VolumeIcon.icns"
fi

# Restore volume icon
if [ -e "/tmp/$3.VolumeIcon.icns" ]; then
cp "/tmp/$3.VolumeIcon.icns" "$4/.VolumeIcon.icns"
if [ -e /Developer/Tools/SetFile ]; then
/Developer/Tools/SetFile -a C "$4" # Set "custom icon" flag for volume
fi
rm -f "/tmp/$3.VolumeIcon.icns"
fi

Actually, is there a reason SuperDuper doesn't have an option to do this automatically?

dnanian 09-19-2006 10:29 PM

When this was written, there wasn't both a before and after script... but this should work fine.

We don't have this in there because we're working on a better way, and it's not a big problem for most people (not enough of a problem to add it to the template)...

john love 09-20-2006 12:08 PM

Icon placement
 
Dave:

Mu drive layout:

internal = iMac Internal HD
external #1 partition #1 = LaCie Sandbox
external #1 partition #2 = LaCie_External_HD
external #2 = LaCie Data HD

I have several icns in my (your) "Volume Icons" folder for both iMac Internal HD and LaCie_External_HD. External #2 isn't bootable as its name implies.

1) When booted off my internal drive and I want to do a "Copy all" clone of this internal drive to a sparseimage on LaCie Data HD, my special icn (= a star) gets properly copied per your Script (Volume Icons/iMac_Internal_DU.VolumeIcon.icns and the destination being iMac_Internal_DU inside "iMac_Internal_DU.sparseimage") ... success - AFTER I eject the disk image and then re-double click on the .sparseimage file! I still count this as a success, even given the required eject and re-expansion.

2) When booted off my internal drive and I want to do a "Shared Users and Apps" clone of this internal drive to LaCie Sandbox, my special icn (= a clam) gets properly copied per your Script (Volume Icons/LaCie SandBox.VolumeIcon.icns and the destination being LaCie SandBox - not a sparseimage) ... success!

3) Now, the "feature" ...

When booted from either iMac Internal HD or LaCie_External_HD and I want to do a "Copy all" clone of LaCie_External_HD to a sparseimage file on LaCie Data HD, the above "star" icon gets copied (iMac_Internal_DU.VolumeIcon.icns, not LaCie_External_DU.VolumeIcon.icns which is a wrench) ... failure!

The destination is a sparseimage file "LaCie_External_DU" on LaCie Data HD with Volume Icons/LaCie_External_DU.VolumeIcon.icns having the correct icon (= a wrench)

4) I do recall your saying awhile ago that all bets are essentially off for a destination of a sparseimage file ... but I am curious why the sparseimage example for (1) works and the sparseimage example for (3) does not work.

John Love

dnanian 09-20-2006 12:46 PM

I'm really not sure why this would act any differently, John. Perhaps you can try the alternate approach "DavidGG" has presented for now.

davebarnes 10-19-2006 12:43 PM

Want different icons, easy to control
 
I just finished reading (well, skimming actually) this discussion.

1. I don't want to do any special coding. I could, but I don't want to. I just want to be able to set a parameter in Preferences.

2. I want the desktop icon of the bootable backup volume to be what I set it to before running SuperDuper. That is, I don't want SD to change it.
I want to be able to visually distinguish between my original volume and my backup. It is that simple.

3. So, please consider this a feature request.

thanks,
dave


All times are GMT -4. The time now is 09:22 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.