#!/bin/sh# XXTH 2024-01-25## * create and install an Menu-Entry (Icon) for your Application# * create a removeIcon.sh script to remove it again# your Application variables:APPNAME="Auteria"EXE="auteria"VERSION="2.30"COMMENT="Auteria https://auteria.com"# relative path to this script.ICON="AuteriaIcon256.png"# multipe Categories are separated with semicolons example: Game;SimulationCATEGORIES="Game"#------------------------------------------------------------------------------# move to current directoryCURPATH=`dirname "{CONTENT}"`cd $CURPATHGAMEPATH=`pwd`DESKTOP_MODE="user"ICON_SIZE="48"DESKTOPFILE=$APPNAME.desktopFILENAME="$GAMEPATH/$DESKTOPFILE"ICONFILE="$GAMEPATH/$ICON"MENUCMD=`command -v xdg-desktop-menu`DESKTOPPATH=$( eval echo "~/Desktop/" )# create desktop file:echo "[Desktop Entry]" > $FILENAMEecho "Version=$VERSION" >> $FILENAMEecho "Type=Application" >> $FILENAMEecho "Name=$APPNAME" >> $FILENAMEecho "Comment=$COMMENT" >> $FILENAMEecho "Exec=$GAMEPATH/$EXE" >> $FILENAMEecho "Icon=$ICONFILE" >> $FILENAMEecho "Path=$GAMEPATH" >> $FILENAMEecho "Terminal=false" >> $FILENAMEecho "Categories=$CATEGORIES" >> $FILENAMEecho "StartupNotify=false" >> $FILENAME# check if we can do anythingif [ ! -d $DESKTOPPATH ] && [ "$MENUCMD" = "" ]; then echo "---------------------------------------" echo "CreateIcon failed!" echo "! Command xdg-desktop-menu not found. " echo "! $DESKTOPPATH does not exists." echo "* but $FILENAME created, you can copy it manually on your Desktop." echo "---------------------------------------" exit 1fi#register in menuif [ "$MENUCMD" != "" ]; then $MENUCMD install --novendor --mode $DESKTOP_MODE $FILENAMEfi# add to desktopif [ -d $DESKTOPPATH ]; then cp $FILENAME $DESKTOPPATHfi#write removeIconREMOVEICONSCRIPT="$CURPATH/removeIcon.sh"echo "#!/bin/sh" > $REMOVEICONSCRIPTif [ "$MENUCMD" != "" ]; then echo "$MENUCMD uninstall --novendor --mode $DESKTOP_MODE $DESKTOPFILE" >> $REMOVEICONSCRIPTfiif [ -d $DESKTOPPATH ]; then echo "rm $DESKTOPPATH/$DESKTOPFILE" >> $REMOVEICONSCRIPTfichmod 755 $REMOVEICONSCRIPTecho "---------------------------------------"echo "CreateIcon finished..."echo "* desktop file: $FILENAME created"if [ "$MENUCMD" != "" ]; then echo "* added $DESKTOPFILE to your menu in Categories: $CATEGORIES"fiif [ -d $DESKTOPPATH ]; then echo "* added $DESKTOPFILE to your Desktop ($DESKTOPPATH)"fiecho "* created $REMOVEICONSCRIPT, if you want to remove the icon"echo "---------------------------------------"