X-Git-Url: https://arthur.barton.de/gitweb/?p=appify.git;a=blobdiff_plain;f=appify.sh;h=537b74c8080422d8f4cc1f1924d8d183863b029f;hp=45c6ea2c75104dc7d3261bab03c9531da1da5d8a;hb=4a927741fca735d0597999cd1952dcc13580db68;hpb=6106ca03cd41e11bf304fdf30bbc1c89d08d0c4c diff --git a/appify.sh b/appify.sh index 45c6ea2..537b74c 100755 --- a/appify.sh +++ b/appify.sh @@ -19,7 +19,7 @@ args=$(getopt h $*) function usage { - echo "Usage: $0 [-h] script.sh target.app" + echo "Usage: $0 [-h] " exit 2 } @@ -43,6 +43,8 @@ fi SCRIPT=$1 TARGET=$2 +BASENAME=`basename "$SCRIPT"` + if [ -e "$TARGET" ]; then echo "$TARGET exists, exiting" 1>&2 exit 3 @@ -59,8 +61,10 @@ fi # done checking args; create the app # -mkdir -p "$TARGET/Contents/MacOS" -mkdir -p "$TARGET/Contents/Resources" +umask 0022 + +mkdir -p "$TARGET/Contents/MacOS" || exit 1 +mkdir -p "$TARGET/Contents/Resources" || exit 1 cat <"$TARGET/Contents/Info.plist" @@ -68,7 +72,7 @@ cat <"$TARGET/Contents/Info.plist" CFBundleExecutable - run.sh + ${BASENAME} CFBundleIconFile CFBundleInfoDictionaryVersion @@ -83,5 +87,5 @@ cat <"$TARGET/Contents/Info.plist" EOF -cp "$SCRIPT" "$TARGET/Contents/MacOS/run.sh" -chmod 755 "$TARGET/Contents/MacOS/run.sh" +cp "$SCRIPT" "$TARGET/Contents/MacOS/$BASENAME" || exit 1 +chmod 755 "$TARGET/Contents/MacOS/$BASENAME" || exit 1