From fe756f881737e425caa22cd51e01ff6721d149be Mon Sep 17 00:00:00 2001 From: Quad Date: Sat, 22 May 2021 23:02:41 +0200 Subject: [PATCH] Add installer --- scripts/tdp-installer | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 scripts/tdp-installer diff --git a/scripts/tdp-installer b/scripts/tdp-installer new file mode 100755 index 0000000..edc3889 --- /dev/null +++ b/scripts/tdp-installer @@ -0,0 +1,38 @@ +#! /usr/bin/bash + +# Hacky script, but gets the job done + +gui_title="Installer" +gui_width=350 + +file_content="[Desktop Entry] +Type=Application +Terminal=false +Name=TDP Manager +Comment=Unofficial TDP manager for GPD Win 3 2 +Exec=bash -c 'export PATH=\"\$PATH:${HOME}/.local/gpd-win3/scripts\";${HOME}/.local/gpd-win3/scripts/tdp gui' +" + +finish_message="A .desktop file has been installed in ~/.local/share/applications/ +" + +if [ -z $(which zenity 2>/dev/null) ] || [ -z $(which tdp 2>/dev/null) ] || [ -z $(which git 2>/dev/null) ]; then + echo "Missing Zenity, or script collection is not properly installed." + echo "Make sure the scripts are in ${HOME}/.local/gpd-win3/scripts" +else + if zenity --question --title=:"$gui_title" --width=$gui_width --text="This installer will add a desktop entry for the TDP manager's GUI. Meaning you will be able to launch it from your application menu like any other software.\n\nDo you wish to proceed?"; then + if zenity --question --title="$gui_title" --width=$gui_width --text="This script collection does not include icons. Do you have your own icon (.png or .svg) that should be used?\nIf you have, answer yes, then select it.\n\nIf unsure, answer no."; then + icon_path=$(zenity --file-selection) + fi + + if ! [ -z $icon_path ]; then + file_content="${file_content}Icon=${icon_path}" + finish_message="${finish_message}And ${icon_path} was used as its icon." + echo "Added icon to desktop entry" + fi + + echo "$file_content" > ~/.local/share/applications/tdp-gui.desktop + zenity --info --title="$gui_title" --width=$gui_width --text="$finish_message" + + fi +fi