From 88d8054d534147b22807c4bf4819692ee30edba9 Mon Sep 17 00:00:00 2001 From: Tristan Ancelet Date: Sat, 18 Nov 2023 18:40:49 -0600 Subject: [PATCH] Added a section that will install the desktop file if it isn't detected as installed --- install-discord-linux.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install-discord-linux.sh b/install-discord-linux.sh index 3ffab8a..a6f8701 100755 --- a/install-discord-linux.sh +++ b/install-discord-linux.sh @@ -8,8 +8,11 @@ VERSION_REGEX='[0-9]+\.[0-9]+\.[0-9]+' INSTALL_DIR=~/.opt EXISTING_INSTALL=$INSTALL_DIR/Discord BUILD_FILE=$EXISTING_INSTALL/resources/build_info.json +DESKTOP_FILE=$EXISTING_INSTALL/discord.desktop PACKAGE_DOWNLOAD_URL_BASE='https://dl.discordapp.net/apps/linux/{VERSION}/discord-{VERSION}.tar.gz' ICON_DIR=~/.icons +DESKTOP_FILE_INSTALLED=0 +[[ -f /usr/share/applications/discord.desktop ]] && DESKTOP_FILE_INSTALLED=1 # END: Variables @@ -105,7 +108,7 @@ function do_install() { [[ ! -d $ICON_DIR ]] && mkdir -p $ICON_DIR cp $EXISTING_INSTALL/discord.png $ICON_DIR/ - desktop-file-isntall $DESKTOP_FILE + sudo desktop-file-isntall $DESKTOP_FILE } function do_upgrade(){ @@ -120,6 +123,10 @@ function do_upgrade(){ tar xf "$FILENAME" update_desktop_file + + if [[ $DESKTOP_FILE_INSTALLED -eq 0 ]]; then + sudo desktop-file-install $DESKTOP_FILE + fi } # END: Helper Functions