Ok, so I've had a play.
I hadn't realised that through the magic of overlayed filesystems that writing to the cwd would write in to the (correct?) appdata directory.
So I've changed the run script to the following:
#!/bin/sh
if [ \! -e .mozilla ]; then
if [ -e ${HOME}/.mozilla ]; then
gksudo --description 'Copying old settings directory' "cp -a ${HOME}/.mozilla ."
if [ $? \!\=0 ]; then
zenity --error --title="Problem" \
--text "Copy of old settings failed" --timeout 6
exit 1
fi
mv ${HOME}/.mozilla ${HOME}/.mozilla-old
else
gksudo --description 'Settings directory setup' "mkdir .mozilla"
if [ $? \!\=0 ]; then
zenity --error --title="Problem" \
--text "Creating new settings directory failed" --timeout 6
exit 1
fi
gksudo --description 'Settings directory setup' "chown ${USER} .mozilla"
if [ $? \!\=0 ]; then
zenity --error --title="Problem" \
--text "Changing ownership of settings directory failed" --timeout 6
exit 1
fi
fi
fi
export HOME=.
./bin/firefox
The idea being that:
1) If you already have a .mozilla directory, it will be moved to the appdata directory.
2) If you don't have a .mozilla directory, it will be created in the appdata directory.
3) The ownership will be correct (This is added because I was testing with root and my login user and had a conflict)
If you guys are happy with this, I'll repackage. I'm not doing it until you are though
Umm, why do you need sudo to copy the files? I mean if you can mv them (just after that cp) you should be able to cp them too. For chown i understand if you really think people have run firefox as root but with HOME set to their home and have an ext2 card (oh what a case...), and with that cp command below, never. FAT32 cards can't store user names /permissions, so as long as the old .mozilla dir can be read (and you already assumed you can move it...), all should be fine. Also you could run cp like this: cp -dR --preserve=timestamps , which is equivalent to cp -a but will not attempt to preserve mode and ownership (both not useful on FAT32).
I agree with urjaman's sentiments.
-God Ginrai
I don't! I use ext2, so permissions & ownership are important to me, so I'd rather go overkill than underkill.
The sudo is needed in case the destination is non-current-user owned. The mv renames directories in the user's home dir, so no extra privs are needed. It's all been added to cope with edge conditions that I have run into.
As for using -ne instead of \!\=, I use -ne for string comparisons & \!\= for numerical comparisons, as a stylistic thing. As for the escapes, I've encountered versions of busybox bash that don't recognise those operators without the escape. So as it does no harm, I'd rather have them in there.
Anyway, enough of the discussion of my coding style. The question was whether this achieves what you want in terms of configuration in the right place. Given the nitpicking hasn't covered that, I'm assuming it's ok, and I'm going ahead with packaging it up. If you're not happy, make your own version. Ner ner ner. (Picks up toys and goes sulk)