X-Git-Url: https://arthur.barton.de/gitweb/?p=appify.git;a=blobdiff_plain;f=appify.sh;h=45c6ea2c75104dc7d3261bab03c9531da1da5d8a;hp=55052f834d8c629e4f8dd166a910ab9b69eacfb0;hb=6106ca03cd41e11bf304fdf30bbc1c89d08d0c4c;hpb=30ee6dda152297bd3ad1524bb365f09283a0ae1f;ds=sidebyside diff --git a/appify.sh b/appify.sh old mode 100644 new mode 100755 index 55052f8..45c6ea2 --- a/appify.sh +++ b/appify.sh @@ -1,39 +1,64 @@ #!/bin/bash - # # appify -- convert your non-interactive shell script into a Mac OS X application # Copyright (C) 2010 Adam Backstrom -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +args=$(getopt h $*) + +function usage { + echo "Usage: $0 [-h] script.sh target.app" + exit 2 +} + +if [ $? != 0 ]; then + usage +fi + +set -- $args +for i ; do + case "$i" + in + -h) usage ; shift ;; + --) shift ; break ;; + esac +done + +if [ $# != 2 ]; then + usage +fi SCRIPT=$1 TARGET=$2 -if [ -d "$TARGET" ]; then +if [ -e "$TARGET" ]; then echo "$TARGET exists, exiting" 1>&2 - exit 1 + exit 3 fi SCRIPTSIZE=$(ls -l "$SCRIPT" | awk '{print $5}') if [ $SCRIPTSIZE -lt 28 ]; then - echo -e "Please pad your script to at least 28 bytes; Mac OS X will not\nrecognize scripts that are smaller than this value." 1>&2 - exit 2 + echo -e "Script smaller than size allowed by OS. Please pad to 28 characters." 1>&2 + exit 4 fi +# +# done checking args; create the app +# + mkdir -p "$TARGET/Contents/MacOS" mkdir -p "$TARGET/Contents/Resources"