This is nicer and we can wrap other scripts than shell: like Perl,
Python, Ruby, ...
SCRIPT=$1
TARGET=$2
+BASENAME=`basename "$SCRIPT"`
+
if [ -e "$TARGET" ]; then
echo "$TARGET exists, exiting" 1>&2
exit 3
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
- <string>run.sh</string>
+ <string>${BASENAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
</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"