Skip to content

Instantly share code, notes, and snippets.

@Gumichan01
Last active May 20, 2018 12:58
Show Gist options
  • Save Gumichan01/b40f78401c412fc976027004c48f8688 to your computer and use it in GitHub Desktop.
Save Gumichan01/b40f78401c412fc976027004c48f8688 to your computer and use it in GitHub Desktop.
Simple script for automatically creating an 'AppDir' in order to create an AppImage
#!/usr/bin/env bash
#
# Simple script for automatically creating an 'AppDir'
#
# https://github.com/AppImage/AppImageKit/wiki/AppDir
# https://github.com/AppImage/AppImageKit/wiki/Creating-AppImages
#
SCRIPT=`basename $0`
function usage {
echo "usage: "$SCRIPT" APP_NAME"
exit -1
}
if [ $# -ne 1 ]
then
usage
fi
MyApp=$1
myapp=`echo -n $1 | tr [:upper:] [:lower:]`
APP_DIR=$MyApp.AppDir
DESKTOP=$APP_DIR/$myapp.desktop
rm -rf $APP_DIR/
mkdir -p $APP_DIR/usr/bin/ && \
echo "WARNING: no executable file provided in '"$MyApp".AppDir/usr/bin/'"
mkdir -p $APP_DIR/usr/lib/
touch $APP_DIR/AppRun && chmod a+x $APP_DIR/AppRun && \
echo "WARNING: empty AppRun file. You must provide it properly"
touch $APP_DIR/$myapp.png && \
echo -e "WARNING: empty/invalid '"$myapp".png'. You must specifiy an image file"
echo -e "INFO: You can provide PNG/JPEG/ICO file, but a PNG file is recommended\n"
echo "[Desktop Entry]" >> $DESKTOP
echo "Name="$MyApp >> $DESKTOP
echo "Exec="$MyApp >> $DESKTOP
echo "Icon=$myapp" >> $DESKTOP
echo "Type=Application" >> $DESKTOP
echo "Categories=Utility;" >> $DESKTOP
echo "Comment=" >> $DESKTOP
echo "Terminal=[true|false]" >> $DESKTOP
# If you have installed tree, you can use it
# tree $APP_DIR/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment