Files
assaultcube-/install_or_remove_menuitem.sh
T
ac-stef fdb7dbd243 new script to check all parts of an installation
also stripped assaultcube.sh, server.sh and install_or_remove_menuitem.sh
of unnecessary or just wrong stuff

added script to generate checksum file packages/misc/checksums_md5.txt,
which is used by check_install.sh to look for missing and modified files
2015-01-18 14:48:47 +01:00

52 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Adds a custom menuitem for AssaultCube to your Desktop's launcher.
CUBE_DIR=$(dirname "$(readlink -f "${0}")")
CUBE_EXEC=assaultcube.sh
LAUNCHERPATH="${HOME}/.local/share/applications/"
LAUNCHERFILE=assaultcube_dev.desktop
LAUNCHERTITLE="Assaultcube v1.2dev"
# Remove existing menuitem, if it exists:
EXISTINGEXEC=`find "${LAUNCHERPATH}" -name "assaultcube*" | xargs`
if [ "$EXISTINGEXEC" != "" ]; then
echo "The following menuitem(s) currently exist:"
echo "$EXISTINGEXEC"
read -p "Would you like them all to be deleted? (y/N): " -r REPLY
if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then
find "${LAUNCHERPATH}" -name "assaultcube*" -delete
echo "Deleted menuitems as requested." && echo ""
exit 0
else
echo "The existing menuitems will remain." && echo ""
fi
fi
mkdir -p "${LAUNCHERPATH}"
cat > "${LAUNCHERPATH}"${LAUNCHERFILE} << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=$LAUNCHERTITLE
Keywords=assaultcube;game;fps;
GenericName=First Person Shooter Game
Categories=Game;ActionGame;Shooter;
Terminal=false
StartupNotify=false
Exec=$CUBE_DIR/$CUBE_EXEC
Icon=$CUBE_DIR/docs/images/icon.png
Comment=A multiplayer, first-person shooter game, based on the CUBE engine. Fast, arcade gameplay.
EOF
chmod +x "${LAUNCHERPATH}"${LAUNCHERFILE}
if [ -x "${LAUNCHERPATH}"${LAUNCHERFILE} ]; then
echo "An AssaultCube menuitem has been successfully created at"
echo "${LAUNCHERPATH}"${LAUNCHERFILE}
exit 0
else
echo "For some reason, we're unable to install an AssaultCube menuitem."
exit 1
fi