Questions, bugs, mkdir fix, feature requests

Gerry JJ trick at
Fri Sep 28 03:18:30 EDT 2007

Hello.  Making a MojoSetup-installer for DROD:TCB here.  Got one working
here now, but I've got a few comments .. =)

First of all, is MojoSetup.installs the intended way of accessing
options that doesn't modify the filesystem (ie not added to the
manifest)?  (eg MojoSetup.installs[1].options[1].options .. If so, I
think accessing installs and options by an id in stead of declaration
order would be more convenient, eg

Also:  In platform_unix.c, MojoPlatform_symlink is currently defined
like this:

boolean MojoPlatform_symlink(const char *src, const char *dst)
    return (symlink(dst, src) == 0);
} // MojoPlatform_symlink

The naming of the arguments leads me to believe that src is supposed to
be the file to be linked (the "source" of the symlink), and dst would
then be the resulting symlink (destination file).  However, since the
arguments are swapped in the call to symlink, the actual result is the
opposite; dst becomes the *destination* of the symlink, and src is,
well, the symlink ("source of ???").  This seems like a bug to me, since
I think the other way would be more intuitive (and more consistent with
rename etc).

I seem to have run into a bug with options too, but I haven't looked
at what's causing that yet.  I just can't seem to get more than one
sub-option of the main required option in my config.lua to show up --
the extra options are parsed and seemingly recognized by MojoSetup, but
they don't show up in any of the GUIs (gtk+2, ncurses, stdio).

MojoPlatform_mkdir would fail in the event that a directory already
exists (as the FIXME text pointed out), so here's a version that

boolean MojoPlatform_mkdir(const char *path, uint16 perms)
    // !!! FIXME: set permissions if already exists?
    struct stat statbuf;
    if (stat(path, &statbuf) != -1)
        return S_ISDIR(statbuf.st_mode);
    return (mkdir(path, perms) == 0);
} // MojoPlatform_mkdir

While I'm at it, some feature requests:

* Uninstaller!  Haven't seen this mentioned before for some reason.
 Making a shell script or whatnot to do the job is easy, but it'd be
 nice to have a Lua-powered uninstaller, automatically remembering
 which options was installed etc.

* Optional menu entries, desktop icon, etc.  Again, this is pretty easy
 to do already with xdg-utils and a postinstall function (+uninstaller),
 but this is such a common thing to do that a built-in way would be
 nice (not to mention more cross-platform).

* A way to write/install generated files through MojoSetup.  This can
 also be done already with Lua and the io functions, but MojoSetup
 doesn't update the manifest that way obviously.

* Being able to directly access/execute files within an archive
 from lua would be nice.

* Detection of existing installations (probably id + install path
 installed somewhere in $HOME, like loki did with the
 ~/.<brand>/installed/*.xml symlink .. which is missing from the
 loki compat btw)

* Updated documentation =).  Seeing a lot of undocumented stuff in the

- Gerry

More information about the mojosetup mailing list