[mojosetup] Uninstall support!

Gerry JJ trick at icculus.org
Thu Jan 24 16:25:17 EST 2008


Den Thu, 24 Jan 2008 06:07:14 -0500
skrev "Ryan C. Gordon" <icculus at icculus.org>:
> 
> As of svn revision #462, MojoSetup has an uninstaller.

Great! =)

> On Unix, this will write out "uninstall-$PACKAGENAME.sh" to the root
> of the installation folder. On Windows, we will eventually hook into 
[..]
> - The installer writes out the shell script like this:
> 
>    #!/bin/sh
>    exec "`dirname $0`"'/.mojosetup/mojosetup' uninstall 'duke3d' $*
>    exit 1

Why "exit 1"?  Since 1 means failure that'll make it seem like the
script always fails for things that want to check that.  Wouldn't it be
better to return the actual return value?  (Would "exit $?" work?)
Also using "$@" in stead of $* would be better, I think, for multiple
arguments.

Actually, having a script in the first place isn't even necessary on
filesystems that support links.  You could just make a symlink
to ".mojosetup/mojosetup" named "uninstall_duke3d", and then
the mojosetup executable could parse its argv[0], finding uninstall
there, and then proceed to get the "duke3d" package id.  This would
also avoid the "really execute this script?" prompt you get in Gnome's
file browser when executing scripts.

Some people run Linux on FAT filesystems and such that don't support
links, so you'd still have to have the script support in there, but
it'd be nice if it only used that as a fallback if link creation fails
though.  (Also it wouldn't work if people renamed the symlink for some
reason, but I don't know how much I care about that, to be honest =] ..
it'd also fail if people edited the script, heh).

- Gerry



More information about the mojosetup mailing list