summary refs log tree commit diff
path: root/misc/linux/install-desktop-entry.sh
diff options
context:
space:
mode:
Diffstat (limited to 'misc/linux/install-desktop-entry.sh')
-rw-r--r--misc/linux/install-desktop-entry.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/misc/linux/install-desktop-entry.sh b/misc/linux/install-desktop-entry.sh
new file mode 100644
index 0000000..a3c3ab7
--- /dev/null
+++ b/misc/linux/install-desktop-entry.sh
@@ -0,0 +1,34 @@
+DESKTOP_FILE=ClassiCube.desktop
+GAME_DIR=`pwd`
+
+# remove existing ClassiCube desktop entry file
+rm $DESKTOP_FILE
+
+# download ClassiCube icon from github if necessary
+if [ -f "CCicon.png" ]
+then
+  echo "CCicon.png exists already. Skipping download."
+else
+  echo "CCicon.png doesn't exist. Attempting to download it.."
+  wget "https://raw.githubusercontent.com/ClassiCube/classicube/master/misc/CCicon.png"
+fi
+
+# create ClassiCube desktop entry
+echo 'Creating ClassiCube.desktop..'
+cat >> $DESKTOP_FILE << EOF
+[Desktop Entry]
+Type=Application
+Comment=Minecraft Classic inspired sandbox game
+Name=ClassiCube
+Exec=$GAME_DIR/ClassiCube
+Icon=$GAME_DIR/CCicon.png
+Path=$GAME_DIR
+Terminal=false
+Categories=Game
+EOF
+chmod +x $DESKTOP_FILE
+
+echo 'Installing ClassiCube.desktop..'
+# install ClassiCube desktop entry into the system
+sudo desktop-file-install --dir=/usr/share/applications ClassiCube.desktop
+sudo update-desktop-database /usr/share/applications