Compare commits
53 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db004f9367 | |||
| e11d8340cd | |||
| 4aa3755b19 | |||
| 0807f98eea | |||
| 1f1573f58c | |||
| 8bace469da | |||
| ae18eac9b9 | |||
| f9a6599993 | |||
| 489fb720c2 | |||
| 42689a9605 | |||
| 3620277b98 | |||
| dd615058c4 | |||
| 969f8b2eb5 | |||
| 4db4454a90 | |||
| 3fa31db0ff | |||
| e608de8eed | |||
| 66054bd6b1 | |||
| 88510e971a | |||
| 1a253d6de5 | |||
| ebc4809ef3 | |||
| 2cae941eea | |||
| c12ea4e331 | |||
| 6eaf261db2 | |||
| 90dd1ea68b | |||
| 6c91e896bc | |||
| 3d4c84ef6c | |||
| f2335fd148 | |||
|
|
434f8b0b70 | ||
| 65453aa3ed | |||
| c49679dd35 | |||
| 4910932c43 | |||
| cf7d8d009c | |||
| 834f929161 | |||
| a88ba74608 | |||
| 1090a4cdd0 | |||
| abc1016148 | |||
| f8498fb44f | |||
| e00b22378e | |||
| 805a80ff89 | |||
| 35ddd28a3b | |||
| 5d9d0cb515 | |||
| 36d673fcd1 | |||
| 3dfa62a71a | |||
| 48b8553198 | |||
| e216d9cc4b | |||
| d480d5c657 | |||
| a638306f2f | |||
| 5cc2a37985 | |||
| 08982535e7 | |||
| 2995cc29b1 | |||
| 75c5bffbe9 | |||
| 17d2815039 | |||
| 2d8c254621 |
6 changed files with 1027 additions and 331 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
test.sh
|
||||
binaries
|
||||
93
README.md
93
README.md
|
|
@ -1,20 +1,76 @@
|
|||
# Helium Bowser installer & updater
|
||||
## Purpose
|
||||
This script was initially designed to just update my Helium browser but over time and interest it got more functional and universal. With "little" tinkering it should be possible to apply this script to install, update & configure many kinds of releases from source like AppImages, binaries, etc...
|
||||
This script was initially designed to just update my Helium browser but over time and interest it got more functional and universal. It includes functions to install, update, remove, add launcher, etc... It's supposed to run in user space and is (Linux) distro independent I suppose.
|
||||
|
||||
With "little" tinkering it should be possible to apply this script to install, update & configure many kinds of releases from source, like Debian packages, AppImages, binaries, etc...
|
||||
## Usage
|
||||
### Help
|
||||
```sh
|
||||
./helium_helper.sh -h
|
||||
```
|
||||
---
|
||||
### First Install
|
||||
To initally install Helium browser via this script, download `helium_helper.sh` and make it executable:
|
||||
```sh
|
||||
wget https://lab.c95.org/fr4nz/helium-helper/raw/branch/main/helium_helper.sh && chmod +x helium_helper.sh
|
||||
```
|
||||
Run script with install parameter _-i_
|
||||
- Default install directory = `$HOME/.apps/Helium`
|
||||
```sh
|
||||
./helium_helper.sh -i
|
||||
```
|
||||
|
||||
**OPTIONAL** : Add alias to `.shellrc` | _working in zsh, bash & fish_
|
||||
- Default alias = `update-helium`
|
||||
```sh
|
||||
./helium_helper.sh -a
|
||||
```
|
||||
|
||||
---
|
||||
### Updating
|
||||
**From launcher** (if added during install or by running `./helium_helper.sh -l`)
|
||||
|
||||
Checking for the latest version and updating can simply be done for the browser as well as the script by right clicking the app icon and choosing either update option, which will be run by `helium_launcher_update.sh`. This will backup all files and configuration and write a log.
|
||||
|
||||
**Terminal**
|
||||
|
||||
Updating can also be done by running:
|
||||
- Update Helium Browser
|
||||
```sh
|
||||
./helium_helper.sh -u
|
||||
```
|
||||
- Update Helium Helper
|
||||
```sh
|
||||
./helium_helper.sh -S
|
||||
```
|
||||
---
|
||||
### Backing up
|
||||
Backing up, by default, pulls all important files, folders & configuration and compresses an archive, which is stored in `$HOME/.apps/Helium/assets`
|
||||
- Default backup
|
||||
```sh
|
||||
./helium_helper.sh -b
|
||||
```
|
||||
- Backup to custom path
|
||||
```sh
|
||||
./helium_helper.sh -b </PATH/TO/DESTINATION>
|
||||
```
|
||||
**NOTE:** The backup path specified won't be overridden within the script yet. Working on it...
|
||||
|
||||
**Since this script is interactive, it doesn't keep logs.**
|
||||
## Overview
|
||||
### Helium_Helper.sh
|
||||
- Interactive installer, updater & configuration script
|
||||
- Installs to `/home/<USER>/.apps/Helium` | changeable in line 28 `INSTALL_PATH`
|
||||
- Installs to `$HOME/.apps/Helium` | changeable in line 32 `INSTALL_PATH`
|
||||
- Assumes:
|
||||
- Presence of `/home/<USER>/.apps/Helium` when updating | changeable in line 28 `INSTALL_PATH`
|
||||
- Presence of `$HOME/.apps/Helium` when updating | changeable in line 32 `INSTALL_PATH`
|
||||
- Executable named `Helium.AppImage`
|
||||
- Keeps backups of
|
||||
- `Helium.AppImage` --> `Helium.AppImage.old`
|
||||
- `helium_helper.sh` --> `helium_helper.sh.old`
|
||||
- `helium_launcher_update.sh` --> `helium_launcher_update.sh.old`
|
||||
- `Helium.desktop` --> `Helium.desktop.old`
|
||||
which will be overwritten at every update
|
||||
- Adds desktop launcher to `/home/<USER>/.local/share/applications`
|
||||
- Keeps backup archives from
|
||||
- `Helium.AppImage`
|
||||
- `helium_helper.sh`
|
||||
- `helium_launcher_update.sh`
|
||||
- `Helium.desktop`
|
||||
- `net.imput.helium`
|
||||
- Adds desktop launcher to `$HOME/.local/share/applications`
|
||||
- Adds options to launcher which are run by `helium_launcher_updater.sh`
|
||||
- Update Helium
|
||||
- Update Script
|
||||
|
|
@ -24,13 +80,14 @@ This script was initially designed to just update my Helium browser but over tim
|
|||
### Helium_Launcher_Update.sh
|
||||
- Update Helium from launcher
|
||||
- Assumes:
|
||||
- Presence of `/home/<USER>/.apps/Helium` when updating | changeable in line 19 `INSTALL_PATH`
|
||||
- Presence of `$HOME/.apps/Helium` when updating | changeable in line 21 `INSTALL_PATH`
|
||||
- Executable named `Helium.AppImage`
|
||||
- Loggs to `/home/<USER>/.apps/Helium/assets/logs`
|
||||
- Keeps backups of
|
||||
- `Helium.AppImage` --> `Helium.AppImage.old`
|
||||
- `helium_helper.sh` --> `helium_helper.sh.old`
|
||||
- `helium_launcher_update.sh` --> `helium_launcher_update.sh.old`
|
||||
- `Helium.desktop` --> `Helium.desktop.old`
|
||||
which will be overwritten at every update
|
||||
- Loggs to `$HOME/.apps/Helium/assets/logs`
|
||||
- Keeps backup archives from
|
||||
- `Helium.AppImage`
|
||||
- `helium_helper.sh`
|
||||
- `helium_launcher_update.sh`
|
||||
- `Helium.desktop`
|
||||
- `net.imput.helium`
|
||||
- Run `helium_launcher_update.sh -h` for help
|
||||
|
||||
3
assets/workflow/merge.yml
Normal file
3
assets/workflow/merge.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
on:
|
||||
pull_requests:
|
||||
pull_request_target:
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
- Launcher has an update option now
|
||||
- Launcher installer refined
|
||||
- Clean Up
|
||||
---
|
||||
- Script updater
|
||||
- Remote script check simplified
|
||||
- Remover function extended
|
||||
|
|
@ -18,16 +19,39 @@
|
|||
- Show log option added
|
||||
- Variables universalized
|
||||
- Wiki created
|
||||
---
|
||||
- sed command fixed in remover
|
||||
- ARCH variable added
|
||||
- APP_SOURCE variable changed
|
||||
- BRANCH variable added
|
||||
- FILE_EXTENSION variable added
|
||||
- Readme updated
|
||||
- Documentation/Wiki updated
|
||||
---
|
||||
- Shell detection added
|
||||
- Alias support for fish added
|
||||
- Removal process refined and adapted to fish
|
||||
- Browser config backup
|
||||
---
|
||||
- Arch detection working
|
||||
- Clean Up
|
||||
- Copy Paste mistake fixed
|
||||
- Backup process rewritten
|
||||
- Custom backup method to pass as argument
|
||||
- Custom backup path to pass as argument
|
||||
- Default if left blank
|
||||
- Removal process adjusted
|
||||
- $1 verifier added
|
||||
- Readme updated
|
||||
---
|
||||
- Notification adjusted for KDE & GNOME
|
||||
|
||||
|
||||
## Add/To Do
|
||||
- Architecture detection
|
||||
- Set alias --> Partially
|
||||
- shell recognition missing
|
||||
- Roll back from backup
|
||||
- Config check
|
||||
- Simplification & Clean Up
|
||||
- Update Readme
|
||||
- Make functional launcher optional
|
||||
- Variable transfer script
|
||||
|
||||
## Repo
|
||||
- Merge workflow
|
||||
999
helium_helper.sh
999
helium_helper.sh
File diff suppressed because it is too large
Load diff
|
|
@ -1,22 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# HELIUM BOWSER AUTO UPDATE SCRIPT WITH LOGGING
|
||||
|
||||
########## PREREQUISITES ###########
|
||||
set -e
|
||||
|
||||
## GLOBAL VARIABLES
|
||||
APP_NAME="Helium"
|
||||
APP_NAME_LONG="Helium Web Browser"
|
||||
SOURCE="GitHub"
|
||||
SCRIPT_NAME="$APP_NAME launcher updater"
|
||||
ARCH="x86_64"
|
||||
FILE_EXTENSION="AppImage"
|
||||
APP_SOURCE="GitHub"
|
||||
SCRIPT_NAME="$APP_NAME Launcher Updater"
|
||||
PARENT_SCRIPT_FILE_NAME="helium_helper.sh"
|
||||
SCRIPT_FILE_NAME="helium_launcher_update.sh"
|
||||
SCRIPT_VERSION="0.5.6"
|
||||
DATE=$(date)
|
||||
SCRIPT_VERSION="0.5.9.1"
|
||||
LOG_DATE=$(date)
|
||||
DATE=$(date +"%d%m%y")
|
||||
|
||||
## NOTIFICATIONS
|
||||
NOTIFY_NAME="Helium Helper"
|
||||
|
||||
## LOCATIONS
|
||||
TMP=/tmp/$APP_NAME
|
||||
INSTALL_PATH=$HOME/.apps/$APP_NAME
|
||||
APP_CONFIG_PATH=$HOME/.config/net.imput.helium
|
||||
ASSET_PATH=$INSTALL_PATH/assets
|
||||
BACKUP_PATH=$ASSET_PATH/backup
|
||||
LOG_PATH=$ASSET_PATH/logs
|
||||
|
|
@ -26,9 +32,10 @@ ICON=$ASSET_PATH/icon/helium.png
|
|||
SCRIPT_PATH=$HOME/.local/bin
|
||||
|
||||
## REMOTE LOCATIONS
|
||||
REMOTE_REPO_URL=https://lab.c95.org/fr4nz/helium-helper/raw/branch/main
|
||||
REMOTE_REPO_BRANCH="main"
|
||||
REMOTE_REPO_URL=https://lab.c95.org/fr4nz/helium-helper/raw/branch/$REMOTE_REPO_BRANCH
|
||||
REMOTE_SCRIPT_URL=$REMOTE_REPO_URL/$SCRIPT_FILE_NAME
|
||||
SOURCE_URL=https://api.github.com/repos/imputnet/helium-linux/releases/latest
|
||||
APP_SOURCE_URL=https://api.github.com/repos/imputnet/helium-linux/releases/latest
|
||||
|
||||
########## FUNCTIONS ###########
|
||||
|
||||
|
|
@ -55,39 +62,131 @@ dependency_check () {
|
|||
mkdir -p $LOG_PATH
|
||||
echo "########## $APP_NAME_LONG update log ##########" >> $LOG
|
||||
echo >> $LOG
|
||||
echo "${DATE} | Log created" >> $LOG
|
||||
echo "$LOG_DATE | Log created" >> $LOG
|
||||
|
||||
fi
|
||||
|
||||
if [ -f "$TMP/missingDeps" ] ; then
|
||||
MISSING=$(cat $TMP/missingDeps)
|
||||
echo "${DATE} | Failed to update - missing dependencies : $MISSING" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update - missing dependencies : $MISSING" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
|
||||
exit_clean
|
||||
|
||||
fi
|
||||
|
||||
if ! [ -d "$INSTALL_PATH" ] ; then
|
||||
mkdir -p $INSTALL_PATH
|
||||
echo "${DATE} | Failed to update - $APP_NAME installation path not present - But created for logging" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update - $APP_NAME installation path not present - But created for logging" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
|
||||
exit
|
||||
|
||||
elif ! [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then
|
||||
echo "${DATE} | Failed to update - Local $APP_NAME AppImage not found" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Update failed! See log for details"
|
||||
elif ! [ -f "$INSTALL_PATH/$APP_NAME.$FILE_EXTENSION" ] ; then
|
||||
echo "$LOG_DATE | Failed to update - Local $APP_NAME AppImage not found" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
### DE CHECK
|
||||
desktop_environment() {
|
||||
ALTERNATIVE_NOTIFY="--app-name="$NOTIFY_NAME""
|
||||
|
||||
if [[ "$(echo $XDG_CURRENT_DESKTOP | grep -iF "kde")" || "$(echo $XDG_CURRENT_DESKTOP | grep -iF "gnome")" ]] ; then
|
||||
NOTIFY_NAME=$ALTERNATIVE_NOTIFY
|
||||
fi
|
||||
}
|
||||
|
||||
### BACKUP
|
||||
backup_helium() {
|
||||
if [[ -d "$INSTALL_PATH" || -d "$SCRIPT_PATH" || -d $APP_CONFIG_PATH ]] ; then
|
||||
BACKUPABLE=("$INSTALL_PATH/$APP_NAME.$FILE_EXTENSION" "$SCRIPT_PATH/$SCRIPT_FILE_NAME" "$SCRIPT_PATH/$AUTO_SCRIPT_FILE_NAME" "$LAUNCHER_PATH/$APP_NAME.desktop" "$APP_CONFIG_PATH")
|
||||
|
||||
for BACKUP_ITEM in ${BACKUPABLE[@]} ; do
|
||||
if [ -d "$BACKUP_ITEM" ] ; then
|
||||
mkdir -p $TMP/backup
|
||||
cp -r $BACKUP_ITEM $TMP/backup
|
||||
|
||||
elif [ -f "$BACKUP_ITEM" ] ; then
|
||||
mkdir -p $TMP/backup
|
||||
cp $BACKUP_ITEM $TMP/backup
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "$TMP/backup" ] ; then
|
||||
CWD=$(pwd)
|
||||
cd $TMP/backup
|
||||
chmod -x *.sh *.$FILE_EXTENSION > /dev/null 2>&1
|
||||
|
||||
if [ "$BACKUP_COMPRESSION_OVERRIDE" ] ; then
|
||||
BACKUP_COMPRESSION=$BACKUP_COMPRESSION_OVERRIDE
|
||||
|
||||
elif ! [ "$BACKUP_COMPRESSION_OVERRIDE" ] ; then
|
||||
COMPRESSION_METHOD=("pbzip2" "gzip" "bzip2" "zip")
|
||||
|
||||
until [ "$BACKUP_COMPRESSION" ] ; do
|
||||
for COMPRESSION_TYPE in ${COMPRESSION_METHOD[@]} ; do
|
||||
|
||||
if [ "$(command -v $COMPRESSION_TYPE) > /dev/null 2>&1" ] ; then
|
||||
BACKUP_COMPRESSION=$COMPRESSION_TYPE
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$BACKUP_COMPRESSION" == "pbzip2" ] ; then
|
||||
tar -cf $APP_NAME.auto_backup_$DATE.tar * > /dev/null 2>&1
|
||||
pbzip2 $APP_NAME.auto_backup_$DATE.tar
|
||||
mkdir -p $BACKUP_PATH
|
||||
mv $APP_NAME.auto_backup_$DATE.tar.bz2 $BACKUP_PATH
|
||||
cd $TMP && rm -rf backup
|
||||
|
||||
elif [ "$BACKUP_COMPRESSION" == "gzip" ] ; then
|
||||
tar -cf $APP_NAME.auto_backup_$DATE.tar * > /dev/null 2>&1
|
||||
gzip $APP_NAME.auto_backup_$DATE.tar
|
||||
mkdir -p $BACKUP_PATH
|
||||
mv $APP_NAME.auto_backup_$DATE.tar.gz $BACKUP_PATH
|
||||
cd $TMP && rm -rf backup
|
||||
|
||||
elif [ "$BACKUP_COMPRESSION" == "bzip2" ] ; then
|
||||
tar -cf $APP_NAME.auto_backup_$DATE.tar * > /dev/null 2>&1
|
||||
bzip2 $APP_NAME.auto_backup_$DATE.tar
|
||||
mkdir -p $BACKUP_PATH
|
||||
mv $APP_NAME.auto_backup_$DATE.tar.bz2 $BACKUP_PATH
|
||||
cd $TMP && rm -rf backup
|
||||
|
||||
elif [ "$BACKUP_COMPRESSION" == "zip" ] ; then
|
||||
tar -cf $APP_NAME.auto_backup_$DATE.tar * > /dev/null 2>&1
|
||||
zip -r $APP_NAME.auto_backup_$DATE.tar.zip $APP_NAME.auto_backup_$DATE.tar > /dev/null 2>&1
|
||||
mkdir -p $BACKUP_PATH
|
||||
mv $APP_NAME.auto_backup_$DATE.tar.zip $BACKUP_PATH
|
||||
cd $TMP && rm -rf backup
|
||||
|
||||
else
|
||||
echo "$LOG_DATE | Backup (uncompressed) written to $BACKUP_PATH" >> $LOG
|
||||
mkdir -p $BACKUP_PATH
|
||||
mv $TMP/backup $BACKUP_PATH/$APP_NAME.auto_backup_$DATE
|
||||
cd $TMP && rm -rf backup
|
||||
fi
|
||||
|
||||
echo "$LOG_DATE | Backup (compressed $BACKUP_COMPRESSION archive) written to $BACKUP_PATH" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Backup created"
|
||||
cd $CWD
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$LOG_DATE | Failed to backup - Nothing worth backing up found" >> $LOG
|
||||
fi
|
||||
}
|
||||
|
||||
### UPDATE SCRIPT
|
||||
update_script() {
|
||||
### CHECK FOR LOCAL SCRIPT
|
||||
if ! [ -f "$SCRIPT_PATH/$SCRIPT_FILE_NAME" ] ; then
|
||||
echo "${DATE} | Failed to update script - local file not found" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update script - local file not found" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
|
||||
exit
|
||||
|
||||
fi
|
||||
|
|
@ -96,13 +195,13 @@ update_script() {
|
|||
|
||||
### CHECK FOR EMPTY VERSION TAGS
|
||||
if [ -z "$SCRIPT_VERSION" ] ; then
|
||||
echo "${DATE} | Failed to update script - Empty version tag --> local" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update script - Empty version tag --> local" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
|
||||
exit
|
||||
|
||||
elif [ -z "$REMOTE_SCRIPT_VERSION" ] ; then
|
||||
echo "${DATE} | Failed to update script - Empty version tag --> $SOURCE" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update script - Empty version tag --> $APP_SOURCE" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
|
||||
exit
|
||||
|
||||
fi
|
||||
|
|
@ -112,68 +211,66 @@ update_script() {
|
|||
REMOTE_SCRIPT_VERSION_NUM=$(echo $REMOTE_SCRIPT_VERSION | tr -d .)
|
||||
|
||||
if [ "$REMOTE_SCRIPT_VERSION" == "$SCRIPT_VERSION" ] ; then
|
||||
notify-send -i "$ICON" "Helium Helper" "Script is up-to-date"
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script is up-to-date"
|
||||
|
||||
elif [ "$REMOTE_SCRIPT_VERSION_NUM" -gt "$SCRIPT_VERSION_NUM" ] ; then
|
||||
mv $SCRIPT_PATH/$SCRIPT_FILE_NAME $BACKUP_PATH/$SCRIPT_FILE_NAME.old
|
||||
mkdir -p $TMP
|
||||
wget -P $TMP $REMOTE_SCRIPT_URL -q
|
||||
chmod +x $TMP/$SCRIPT_FILE_NAME
|
||||
mv $TMP/$SCRIPT_FILE_NAME $SCRIPT_PATH
|
||||
echo "${DATE} | Script updated to $REMOTE_SCRIPT_VERSION" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Script updated to $REMOTE_SCRIPT_VERSION"
|
||||
wget -P $TMP $REMOTE_REPO_URL/$PARENT_SCRIPT_FILE_NAME -q
|
||||
chmod +x $TMP/$SCRIPT_FILE_NAME $TMP/$PARENT_SCRIPT_FILE_NAME
|
||||
mv $TMP/$SCRIPT_FILE_NAME $TMP/$PARENT_SCRIPT_FILE_NAME $SCRIPT_PATH
|
||||
echo "$LOG_DATE | Script updated to version $REMOTE_SCRIPT_VERSION" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script updated to version $REMOTE_SCRIPT_VERSION"
|
||||
|
||||
else
|
||||
echo "${DATE} | Failed to update - Malformed version tags" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details\n$REMOTE_SCRIPT_VERSION $SCRIPT_VERSION"
|
||||
|
||||
echo "$LOG_DATE | Failed to update - Malformed version tags" >> $LOG
|
||||
echo "$LOG_DATE | Remote Version: $REMOTE_SCRIPT_VERSION" >> $LOG
|
||||
echo "$LOG_DATE | Local Version: $SCRIPT_VERSION" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
|
||||
fi
|
||||
}
|
||||
|
||||
### UPDATE
|
||||
update_helium() {
|
||||
DOWNLOAD_URL=$(curl -s $SOURCE_URL | grep "browser_download_url" | grep "x86_64.AppImage" | grep -v "zsync" | tr -d \" | awk '{print $2}')
|
||||
SOURCE_FILENAME=$(curl -s $SOURCE_URL | grep "browser_download_url" | grep "x86_64.AppImage" | grep -v "zsync" | tr -d \" | awk '{print $2}' | awk -F'/' '{print $9}')
|
||||
LOCAL_VERSION=$($INSTALL_PATH/$APP_NAME.AppImage --version | awk '{print $2}')
|
||||
SOURCE_VERSION=$(curl -s $SOURCE_URL | grep "tag_name" | tr -d \", | awk '{print $2}')
|
||||
DOWNLOAD_URL=$(curl -s $APP_SOURCE_URL | grep "browser_download_url" | grep "$ARCH.$FILE_EXTENSION" | grep -v "zsync" | tr -d \" | awk '{print $2}')
|
||||
APP_SOURCE_FILENAME=$(curl -s $APP_SOURCE_URL | grep "browser_download_url" | grep "$ARCH.$FILE_EXTENSION" | grep -v "zsync" | tr -d \" | awk '{print $2}' | awk -F'/' '{print $9}')
|
||||
LOCAL_VERSION=$($INSTALL_PATH/$APP_NAME.$FILE_EXTENSION --version | awk '{print $2}')
|
||||
APP_SOURCE_VERSION=$(curl -s $APP_SOURCE_URL | grep "tag_name" | tr -d \", | awk '{print $2}')
|
||||
|
||||
### CHECK FOR EMPTY VERSION TAGS
|
||||
if [[ -z "$SOURCE_VERSION" ]] ; then
|
||||
echo "${DATE} | Failed to update - Empty version tag --> $SOURCE" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Browser update failed! See log for details"
|
||||
if [[ -z "$APP_SOURCE_VERSION" ]] ; then
|
||||
echo "$LOG_DATE | Failed to update - Empty version tag --> $APP_SOURCE" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
|
||||
exit
|
||||
|
||||
elif [[ -z "$LOCAL_VERSION" ]] ; then
|
||||
echo "${DATE} | Failed to update - Empty version tag --> LOCAL" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Browser update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update - Empty version tag --> LOCAL" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
### COMPARE LOCAL & REMOTE VERSION
|
||||
LOCAL_VERSION_NUM=$(echo $LOCAL_VERSION | tr -d .)
|
||||
SOURCE_VERSION_NUM=$(echo $SOURCE_VERSION | tr -d .)
|
||||
APP_SOURCE_VERSION_NUM=$(echo $APP_SOURCE_VERSION | tr -d .)
|
||||
|
||||
if [ "$SOURCE_VERSION" == "$LOCAL_VERSION" ] ; then
|
||||
notify-send -i "$ICON" "Helium Helper" "Browser is up-to-date"
|
||||
if [ "$APP_SOURCE_VERSION" == "$LOCAL_VERSION" ] ; then
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser is up-to-date"
|
||||
|
||||
elif [ "$SOURCE_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then
|
||||
mkdir -p $TMP $BACKUP_PATH
|
||||
wget -P $TMP $DOWNLOAD_URL -q --show-progress
|
||||
chmod +x $TMP/$SOURCE_FILENAME
|
||||
if [ -f "$BACKUP_PATH/$APP_NAME.AppImage.old" ] ; then
|
||||
rm $BACKUP_PATH/$APP_NAME.AppImage.old
|
||||
fi
|
||||
mv $INSTALL_PATH/$APP_NAME.AppImage $BACKUP_PATH/$APP_NAME.AppImage.old
|
||||
mv $TMP/$SOURCE_FILENAME $INSTALL_PATH/$APP_NAME.AppImage
|
||||
cp $LAUNCHER_PATH/$APP_NAME.desktop $BACKUP_PATH/$APP_NAME.desktop.old
|
||||
sed -i "s|X-AppImage-Version=.*|X-AppImage-Version=$($INSTALL_PATH/$APP_NAME.AppImage --version | awk '{print $2}')|" $LAUNCHER_PATH/$APP_NAME.desktop
|
||||
echo "${DATE} | $APP_NAME updated to ${SOURCE_VERSION}" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Browser updated to $SOURCE_VERSION"
|
||||
elif [ "$APP_SOURCE_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then
|
||||
mkdir -p $TMP
|
||||
wget -P $TMP $DOWNLOAD_URL -q
|
||||
chmod +x $TMP/$APP_SOURCE_FILENAME
|
||||
backup_helium
|
||||
mv $TMP/$APP_SOURCE_FILENAME $INSTALL_PATH/$APP_NAME.$FILE_EXTENSION
|
||||
sed -i "s|X-AppImage-Version=.*|X-AppImage-Version=$($INSTALL_PATH/$APP_NAME.$FILE_EXTENSION --version | awk '{print $2}')|" $LAUNCHER_PATH/$APP_NAME.desktop
|
||||
echo "$LOG_DATE | $APP_NAME updated to version ${APP_SOURCE_VERSION}" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser updated to version $APP_SOURCE_VERSION"
|
||||
|
||||
else
|
||||
echo "${DATE} | Failed to update - Version tags malformed" >> $LOG
|
||||
notify-send -i "$ICON" "Helium Helper" "Browser update failed! See log for details"
|
||||
echo "$LOG_DATE | Failed to update - Version tags malformed" >> $LOG
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
|
||||
exit
|
||||
|
||||
fi
|
||||
|
|
@ -192,7 +289,7 @@ show_log() {
|
|||
xdg-open $LOG
|
||||
|
||||
else
|
||||
notify-send -i "$ICON" "Helium Helper" "No log created yet"
|
||||
notify-send --icon="$ICON" "$NOTIFY_NAME" "No log created yet"
|
||||
|
||||
fi
|
||||
}
|
||||
|
|
@ -229,6 +326,13 @@ exit_clean() {
|
|||
|
||||
## GET OPTIONS
|
||||
while getopts ":a,:s,:S,:L,:h" OPTION ; do
|
||||
|
||||
if [ "$(echo $1 | wc -m)" -gt "3" ] ; then
|
||||
echo -e "\n${YEL}Option ${RED}$1${YEL} not valid! Use only one parameter at a time...${CRS}"
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
case $OPTION in
|
||||
|
||||
S)
|
||||
|
|
@ -260,6 +364,9 @@ done
|
|||
## DEPENDENCY CHECK
|
||||
dependency_check
|
||||
|
||||
## DE CHECK
|
||||
desktop_environment
|
||||
|
||||
## UPDATE
|
||||
update_helium
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue