[PATCH] Fix typos and shell for MacOSX packaging scripts

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Wed Oct 3 14:01:10 PDT 2012


On Wed, 3 Oct 2012, Henrik Brautaset Aronsen wrote:
> Den 03.10.12 21:12, skrev Cristian Ionescu-Idbohrn:
> > What do:
> >
> > 	APPLECOLLATION
> > 	APPLELOCALE
> >
> > show ona a MacOSX, anyway?  Worst case ;)
>
> On my machine, these give:
>
> $ defaults read .GlobalPreferences AppleCollationOrder
> nb
> $ defaults read .GlobalPreferences AppleLocale
> nb_NO

Henrik har some answers, indeed :)  But I'd very much want to find out
more, if possible.  Anyone?

> (By the way, I regret touching /bin/sh now.

Well, you shouldn't.

> IMHO it's a good idea to keep subsurface.sh as close to the original
> gtk-mac-bundler/bundler/launcher.sh as possible.  That way it's easier
> to merge changes when it changes.)

I would be interested in looking at a copy of that file, please.

Thing is, as it stands, '#!/bin/bash' is required.  The script would break
if run under shells not supporting bashisms.  I managed to reduce bashisms
to this:

possible bashism in packaging/macosx/subsurface.sh line 62 (${foo:3[:1]}):
                if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then
possible bashism in packaging/macosx/subsurface.sh line 64 (${foo:3[:1]}):
                        export LANG=${L:0:2}
possible bashism in packaging/macosx/subsurface.sh line 69 (${foo:3[:1]}):
                if test "${L:0:2}" = en; then
possible bashism in packaging/macosx/subsurface.sh line 82 (${foo:3[:1]}):
        if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then
possible bashism in packaging/macosx/subsurface.sh line 84 (${foo:3[:1]}):
                export LANG=${APPLECOLLATION:0:2}
possible bashism in packaging/macosx/subsurface.sh line 96 (${foo:3[:1]}):
if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then
possible bashism in packaging/macosx/subsurface.sh line 99 (${foo:3[:1]}):
                export LANG=${APPLELOCALE:0:5}
possible bashism in packaging/macosx/subsurface.sh line 102 (${foo:3[:1]}):
elif test -z "$LANG" && -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then
possible bashism in packaging/macosx/subsurface.sh line 104 (${foo:3[:1]}):
        export LANG=${APPLELOCALE:0:2}
possible bashism in packaging/macosx/subsurface.sh line 116 (${foo:3[:1]}):
        if test "$LANG" = ${APPLELOCALE:0:5} || "$LANG" != ${LANG:0:2}; then
possible bashism in packaging/macosx/subsurface.sh line 121 (${foo:3[:1]}):
        elif test "$LANG" = ${APPLELOCALE:0:2} && $APPLELOCALE > ${APPLELOCALE:0:2}; then
possible bashism in packaging/macosx/subsurface.sh line 123 (${foo:3[:1]}):
                export LC_MESSAGES=${APPLELOCALE:0:5}
possible bashism in packaging/macosx/subsurface.sh line 160 (${foo:3[:1]}):
        LC_MONETARY=${APPLELOCALE:0:5}

and that's the '${parameter:offset:length}' substring expansion basism.
Now, I don't think it's smart for a project to force users to use bash,
in particular because of this (see `man 1 bash'):

	BUGS
		It's too big and too slow.

		There are some subtle differences between bash and
		traditional versions of sh, mostly because of the POSIX
		specification.


Cheers,

-- 
Cristian


More information about the subsurface mailing list