Added new section that will handle installing the desktop file if it isn't already

This commit is contained in:
Tristan Ancelet 2023-12-01 12:08:37 -06:00
parent 2291793f6d
commit 47fbc1cb8a

View File

@ -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