Added a section that will install the desktop file if it isn't detected as installed

This commit is contained in:
Tristan Ancelet 2023-11-18 18:40:49 -06:00
parent 0a53b9674d
commit 88d8054d53

View File

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