removed redirect into /dev/null for installer download (so that the user is aware that a download is happening)

This commit is contained in:
Tristan Ancelet 2023-12-03 22:13:01 -06:00
parent 2a7519024c
commit 4873410cd2

View File

@ -51,6 +51,7 @@ ACTION=""
DOWNLOAD_URL='https://discord.com/api/download/stable?platform=linux&format=tar.gz'
VERSION_REGEX='[0-9]+\.[0-9]+\.[0-9]+'
INSTALL_DIR=~/.opt
[[ ! -d $INSTALL_DIR ]] && mkdir -p $INSTALL_DIR
LOCAL_APPLICATION_DIR=~/.local/share/applications
EXISTING_INSTALL=$INSTALL_DIR/Discord
BUILD_FILE=$EXISTING_INSTALL/resources/build_info.json
@ -59,6 +60,7 @@ INSTALLED_DESKTOP_FILE=$LOCAL_APPLICATION_DIR/discord.desktop
PACKAGE_DOWNLOAD_URL_BASE='https://dl.discordapp.net/apps/linux/{VERSION}/discord-{VERSION}.tar.gz'
ICON_DIR=~/.local/share/icons
DESKTOP_FILE_NEEDS_UPDATE=0
REMOVE_AFTER_INSTALL=1
# END: Variables
@ -102,10 +104,10 @@ function do_download(){
## Getting filename from url
### Removing all characters from the last / back to leave only the filename
FILENAME="${PACKAGE_DOWNLOAD_URL/*\/}"
log "File was downloaded as $FILENAME"
## Downloading the discord package (tar.gz)
curl "$PACKAGE_DOWNLOAD_URL" -o "$FILENAME" >/dev/null 2>&1
curl "$PACKAGE_DOWNLOAD_URL" -o "$FILENAME"
log "File was downloaded as $FILENAME"
}
function update_desktop_file() {
@ -137,6 +139,12 @@ function update_desktop_file() {
}
function remove_installer () {
if [[ $REMOVE_AFTER_INSTALL -eq 1 ]]; then
rm -f $FILENAME
fi
}
function do_install() {
cd "$INSTALL_DIR"
@ -156,6 +164,8 @@ function do_install() {
[[ ! -d $ICON_DIR ]] && mkdir -p $ICON_DIR
cp $EXISTING_INSTALL/discord.png $ICON_DIR/
remove_installer
}
function do_upgrade(){
@ -170,6 +180,8 @@ function do_upgrade(){
tar xf "$FILENAME"
update_desktop_file
remove_installer
}
# END: Helper Functions