[mojosetup] Uninstall support!

Ryan C. Gordon icculus at icculus.org
Thu Jan 24 20:58:42 EST 2008

>>    #!/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.

The "exec" replaces the /bin/sh process with the "mojosetup" one...if 
you hit the "exit" line at all, it means the program failed to run.

Then again, I just noticed that "exec" sets the error code to 127, so 
the "exit 1" isn't necessary. I'm tempted to leave it, just in case a 
broken shell doesn't do it, though.

> 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.

Eh, I don't know...seems like bad practice to rely on the value of 
argv[0] for commands. I know some Unix things do this, but I'm not sure 
I'm comfortable with it. Let me think about it.


More information about the mojosetup mailing list