Use original script file name instead of "run.sh"
authorAlexander Barton <alex@barton.de>
Wed, 8 Apr 2015 09:48:20 +0000 (11:48 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 8 Apr 2015 09:48:20 +0000 (11:48 +0200)
This is nicer and we can wrap other scripts than shell: like Perl,
Python, Ruby, ...

appify.sh

index 45c6ea2..1ebf8bb 100755 (executable)
--- a/appify.sh
+++ b/appify.sh
@@ -43,6 +43,8 @@ fi
 SCRIPT=$1
 TARGET=$2
 
+BASENAME=`basename "$SCRIPT"`
+
 if [ -e "$TARGET" ]; then
     echo "$TARGET exists, exiting" 1>&2
     exit 3
@@ -68,7 +70,7 @@ cat <<EOF >"$TARGET/Contents/Info.plist"
 <plist version="1.0">
 <dict>
     <key>CFBundleExecutable</key>
-    <string>run.sh</string>
+    <string>${BASENAME}</string>
     <key>CFBundleIconFile</key>
     <string></string>
     <key>CFBundleInfoDictionaryVersion</key>
@@ -83,5 +85,5 @@ cat <<EOF >"$TARGET/Contents/Info.plist"
 </plist>
 EOF
 
-cp "$SCRIPT" "$TARGET/Contents/MacOS/run.sh"
-chmod 755 "$TARGET/Contents/MacOS/run.sh"
+cp "$SCRIPT" "$TARGET/Contents/MacOS/$BASENAME"
+chmod 755 "$TARGET/Contents/MacOS/$BASENAME"