diff --git a/install-discord-linux.sh b/install-discord-linux.sh index 0f25efd..4c6e3ac 100755 --- a/install-discord-linux.sh +++ b/install-discord-linux.sh @@ -13,6 +13,7 @@ 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 +LOCAL_APPLICATION_DIR=~/.local/share/applications [[ -f /usr/share/applications/discord.desktop ]] && DESKTOP_FILE_INSTALLED=1 # END: Variables @@ -135,10 +136,6 @@ 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 @@ -197,3 +194,20 @@ esac # END: Work + + +# BEGIN: End Work Check + +## If discord isn't already setup in your global applications, go ahead and install the desktop file +if [[ ! -f $LOCAL_APPLICATION_DIR/discord.desktop ]]; then + log "Desktop file not found in the global applications dir (/usr/share/applications) installing now, asking user for sudo access" + sudo desktop-file-install --dir=$LOCAL_APPLICATION_DIR $DESKTOP_FILE + + if [[ $? -ne 0 ]]; then + log "There was an issue with installtion" + else + log "Desktop file was successfully installed" + fi +fi + +# END: End Work Check