Compare commits

..

53 commits
0.5.6 ... main

Author SHA1 Message Date
db004f9367 Restore select function added; Decompress function added; Configure restore function added 2026-01-16 14:33:51 +01:00
e11d8340cd Init restore function added;
path correction function added
2026-01-14 01:05:38 +01:00
4aa3755b19 revert help abuse 2026-01-12 19:25:20 +01:00
0807f98eea Backup function fixed if pbzip2 was not installed 2026-01-12 19:18:29 +01:00
1f1573f58c Backup function fixed if pbzip2 was not installed 2026-01-12 19:17:23 +01:00
8bace469da update 2026-01-11 22:27:22 +01:00
ae18eac9b9 Backup logger refinements 2026-01-11 22:26:47 +01:00
f9a6599993 Config logger added for reverting from backup 2026-01-11 21:57:56 +01:00
489fb720c2 Update 2026-01-11 17:49:55 +01:00
42689a9605 DE check for propper notification on kde and gnome 2026-01-11 17:49:20 +01:00
3620277b98 Output adjustment 2026-01-10 19:03:18 +01:00
dd615058c4 Hotfix date confusion 2026-01-10 18:22:32 +01:00
969f8b2eb5 zip hotfix 2026-01-10 17:02:12 +01:00
4db4454a90 Architecture verification added 2026-01-10 15:25:06 +01:00
3fa31db0ff More research on workflows 2026-01-10 14:19:07 +01:00
e608de8eed Version bumped --> 0.5.9 2026-01-10 14:18:16 +01:00
66054bd6b1 Prep for workflows 2026-01-10 12:59:59 +01:00
88510e971a Backup process refined 2026-01-10 12:58:37 +01:00
1a253d6de5 Docu updated 2026-01-10 12:07:17 +01:00
ebc4809ef3 Readme updated 2026-01-10 12:06:50 +01:00
2cae941eea Typo fixed 2026-01-09 00:24:30 +01:00
c12ea4e331 Readme updated 2026-01-09 00:16:24 +01:00
6eaf261db2 Readme updated 2026-01-09 00:14:29 +01:00
90dd1ea68b Readme updated 2026-01-09 00:10:56 +01:00
6c91e896bc update 2026-01-08 23:44:14 +01:00
3d4c84ef6c Backup function added 2026-01-08 23:43:56 +01:00
f2335fd148 Backup function added ;
Script output refined ;
Custom alias through $2 added;
Arch detection added ;
Removal Process adatptions ;
2026-01-08 23:42:44 +01:00
Fr4nz D13trich
434f8b0b70 binaries ignored 2026-01-05 11:49:59 -07:00
65453aa3ed deleted: assets/binaries/helium_helper.sh.x.c
deleted:    assets/binaries/helium_launcher_update.sh.x.c
modified:   devdoc.md
deleted:    launcher-update-helium
deleted:    update-helium
2026-01-02 23:24:52 +01:00
c49679dd35 Config Backup added; FISH alias added; FISH alias removal added 2026-01-02 19:15:14 +01:00
4910932c43 FISH config removal process added 2026-01-02 17:24:11 +01:00
cf7d8d009c Alias configuration for FISH added 2026-01-02 17:07:18 +01:00
834f929161 Alias configuration for FISH added 2026-01-02 17:01:13 +01:00
a88ba74608 Alias configuration for FISH added 2026-01-02 16:55:48 +01:00
1090a4cdd0 Alias configuration for FISH added 2026-01-02 16:51:06 +01:00
abc1016148 Alias configuration for FISH added 2026-01-02 16:12:54 +01:00
f8498fb44f Alias configuration for FISH added 2026-01-02 16:07:13 +01:00
e00b22378e Alias configuration for FISH added 2026-01-02 16:05:16 +01:00
805a80ff89 Alias configuration for FISH added 2026-01-02 16:03:07 +01:00
35ddd28a3b Removal process updated; Alias configuration for FISH added 2026-01-02 16:00:52 +01:00
5d9d0cb515 Helium config variable added 2025-12-31 00:20:35 +01:00
36d673fcd1 Script compiled with shc 2025-12-28 18:19:46 +01:00
3dfa62a71a Docs updated; gitignore added 2025-12-28 14:11:40 +01:00
48b8553198 Output beautified 2025-12-28 14:11:00 +01:00
e216d9cc4b Script version bumped 2025-12-28 00:29:54 +01:00
d480d5c657 update 2025-12-28 00:25:25 +01:00
a638306f2f update 2025-12-28 00:20:53 +01:00
5cc2a37985 update 2025-12-28 00:19:05 +01:00
08982535e7 Cleanup 2025-12-28 00:18:58 +01:00
2995cc29b1 update 2025-12-27 23:33:11 +01:00
75c5bffbe9 Multiple variables added 2025-12-27 23:33:01 +01:00
17d2815039 Fixed faulty sed command in removal function 2025-12-27 22:30:02 +01:00
2d8c254621 update 2025-12-27 18:53:36 +01:00
6 changed files with 1027 additions and 331 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
test.sh
binaries

View file

@ -1,20 +1,76 @@
# Helium Bowser installer & updater # Helium Bowser installer & updater
## Purpose ## 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 ## Overview
### Helium_Helper.sh ### Helium_Helper.sh
- Interactive installer, updater & configuration script - 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: - 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` - Executable named `Helium.AppImage`
- Keeps backups of - Keeps backup archives from
- `Helium.AppImage` --> `Helium.AppImage.old` - `Helium.AppImage`
- `helium_helper.sh` --> `helium_helper.sh.old` - `helium_helper.sh`
- `helium_launcher_update.sh` --> `helium_launcher_update.sh.old` - `helium_launcher_update.sh`
- `Helium.desktop` --> `Helium.desktop.old` - `Helium.desktop`
which will be overwritten at every update - `net.imput.helium`
- Adds desktop launcher to `/home/<USER>/.local/share/applications` - Adds desktop launcher to `$HOME/.local/share/applications`
- Adds options to launcher which are run by `helium_launcher_updater.sh` - Adds options to launcher which are run by `helium_launcher_updater.sh`
- Update Helium - Update Helium
- Update Script - Update Script
@ -24,13 +80,14 @@ This script was initially designed to just update my Helium browser but over tim
### Helium_Launcher_Update.sh ### Helium_Launcher_Update.sh
- Update Helium from launcher - Update Helium from launcher
- Assumes: - 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` - Executable named `Helium.AppImage`
- Loggs to `/home/<USER>/.apps/Helium/assets/logs` - Loggs to `$HOME/.apps/Helium/assets/logs`
- Keeps backups of - Keeps backup archives from
- `Helium.AppImage` --> `Helium.AppImage.old` - `Helium.AppImage`
- `helium_helper.sh` --> `helium_helper.sh.old` - `helium_helper.sh`
- `helium_launcher_update.sh` --> `helium_launcher_update.sh.old` - `helium_launcher_update.sh`
- `Helium.desktop` --> `Helium.desktop.old` - `Helium.desktop`
which will be overwritten at every update - `net.imput.helium`
- Run `helium_launcher_update.sh -h` for help - Run `helium_launcher_update.sh -h` for help
&nbsp;

View file

@ -0,0 +1,3 @@
on:
pull_requests:
pull_request_target:

View file

@ -6,6 +6,7 @@
- Launcher has an update option now - Launcher has an update option now
- Launcher installer refined - Launcher installer refined
- Clean Up - Clean Up
---
- Script updater - Script updater
- Remote script check simplified - Remote script check simplified
- Remover function extended - Remover function extended
@ -18,16 +19,39 @@
- Show log option added - Show log option added
- Variables universalized - Variables universalized
- Wiki created - 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 ## Add/To Do
- Architecture detection
- Set alias --> Partially
- shell recognition missing
- Roll back from backup - Roll back from backup
- Config check
- Simplification & Clean Up
- Update Readme - Update Readme
- Make functional launcher optional - Make functional launcher optional
- Variable transfer script
## Repo ## Repo
- Merge workflow - Merge workflow

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,28 @@
#!/bin/bash #!/bin/bash
# HELIUM BOWSER AUTO UPDATE SCRIPT WITH LOGGING # HELIUM BOWSER AUTO UPDATE SCRIPT WITH LOGGING
########## PREREQUISITES ########### ########## PREREQUISITES ###########
set -e set -e
## GLOBAL VARIABLES ## GLOBAL VARIABLES
APP_NAME="Helium" APP_NAME="Helium"
APP_NAME_LONG="Helium Web Browser" APP_NAME_LONG="Helium Web Browser"
SOURCE="GitHub" ARCH="x86_64"
SCRIPT_NAME="$APP_NAME launcher updater" 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_FILE_NAME="helium_launcher_update.sh"
SCRIPT_VERSION="0.5.6" SCRIPT_VERSION="0.5.9.1"
DATE=$(date) LOG_DATE=$(date)
DATE=$(date +"%d%m%y")
## NOTIFICATIONS
NOTIFY_NAME="Helium Helper"
## LOCATIONS ## LOCATIONS
TMP=/tmp/$APP_NAME TMP=/tmp/$APP_NAME
INSTALL_PATH=$HOME/.apps/$APP_NAME INSTALL_PATH=$HOME/.apps/$APP_NAME
APP_CONFIG_PATH=$HOME/.config/net.imput.helium
ASSET_PATH=$INSTALL_PATH/assets ASSET_PATH=$INSTALL_PATH/assets
BACKUP_PATH=$ASSET_PATH/backup BACKUP_PATH=$ASSET_PATH/backup
LOG_PATH=$ASSET_PATH/logs LOG_PATH=$ASSET_PATH/logs
@ -26,9 +32,10 @@ ICON=$ASSET_PATH/icon/helium.png
SCRIPT_PATH=$HOME/.local/bin SCRIPT_PATH=$HOME/.local/bin
## REMOTE LOCATIONS ## 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 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 ########### ########## FUNCTIONS ###########
@ -55,39 +62,131 @@ dependency_check () {
mkdir -p $LOG_PATH mkdir -p $LOG_PATH
echo "########## $APP_NAME_LONG update log ##########" >> $LOG echo "########## $APP_NAME_LONG update log ##########" >> $LOG
echo >> $LOG echo >> $LOG
echo "${DATE} | Log created" >> $LOG echo "$LOG_DATE | Log created" >> $LOG
fi fi
if [ -f "$TMP/missingDeps" ] ; then if [ -f "$TMP/missingDeps" ] ; then
MISSING=$(cat $TMP/missingDeps) MISSING=$(cat $TMP/missingDeps)
echo "${DATE} | Failed to update - missing dependencies : $MISSING" >> $LOG echo "$LOG_DATE | Failed to update - missing dependencies : $MISSING" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
exit_clean exit_clean
fi fi
if ! [ -d "$INSTALL_PATH" ] ; then if ! [ -d "$INSTALL_PATH" ] ; then
mkdir -p $INSTALL_PATH mkdir -p $INSTALL_PATH
echo "${DATE} | Failed to update - $APP_NAME installation path not present - But created for logging" >> $LOG echo "$LOG_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" notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
exit exit
elif ! [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then elif ! [ -f "$INSTALL_PATH/$APP_NAME.$FILE_EXTENSION" ] ; then
echo "${DATE} | Failed to update - Local $APP_NAME AppImage not found" >> $LOG echo "$LOG_DATE | Failed to update - Local $APP_NAME AppImage not found" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
exit exit
fi 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
update_script() { update_script() {
### CHECK FOR LOCAL SCRIPT ### CHECK FOR LOCAL SCRIPT
if ! [ -f "$SCRIPT_PATH/$SCRIPT_FILE_NAME" ] ; then if ! [ -f "$SCRIPT_PATH/$SCRIPT_FILE_NAME" ] ; then
echo "${DATE} | Failed to update script - local file not found" >> $LOG echo "$LOG_DATE | Failed to update script - local file not found" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
exit exit
fi fi
@ -96,13 +195,13 @@ update_script() {
### CHECK FOR EMPTY VERSION TAGS ### CHECK FOR EMPTY VERSION TAGS
if [ -z "$SCRIPT_VERSION" ] ; then if [ -z "$SCRIPT_VERSION" ] ; then
echo "${DATE} | Failed to update script - Empty version tag --> local" >> $LOG echo "$LOG_DATE | Failed to update script - Empty version tag --> local" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
exit exit
elif [ -z "$REMOTE_SCRIPT_VERSION" ] ; then elif [ -z "$REMOTE_SCRIPT_VERSION" ] ; then
echo "${DATE} | Failed to update script - Empty version tag --> $SOURCE" >> $LOG echo "$LOG_DATE | Failed to update script - Empty version tag --> $APP_SOURCE" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Script update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
exit exit
fi fi
@ -112,68 +211,66 @@ update_script() {
REMOTE_SCRIPT_VERSION_NUM=$(echo $REMOTE_SCRIPT_VERSION | tr -d .) REMOTE_SCRIPT_VERSION_NUM=$(echo $REMOTE_SCRIPT_VERSION | tr -d .)
if [ "$REMOTE_SCRIPT_VERSION" == "$SCRIPT_VERSION" ] ; then 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 elif [ "$REMOTE_SCRIPT_VERSION_NUM" -gt "$SCRIPT_VERSION_NUM" ] ; then
mv $SCRIPT_PATH/$SCRIPT_FILE_NAME $BACKUP_PATH/$SCRIPT_FILE_NAME.old mv $SCRIPT_PATH/$SCRIPT_FILE_NAME $BACKUP_PATH/$SCRIPT_FILE_NAME.old
mkdir -p $TMP mkdir -p $TMP
wget -P $TMP $REMOTE_SCRIPT_URL -q wget -P $TMP $REMOTE_SCRIPT_URL -q
chmod +x $TMP/$SCRIPT_FILE_NAME wget -P $TMP $REMOTE_REPO_URL/$PARENT_SCRIPT_FILE_NAME -q
mv $TMP/$SCRIPT_FILE_NAME $SCRIPT_PATH chmod +x $TMP/$SCRIPT_FILE_NAME $TMP/$PARENT_SCRIPT_FILE_NAME
echo "${DATE} | Script updated to $REMOTE_SCRIPT_VERSION" >> $LOG mv $TMP/$SCRIPT_FILE_NAME $TMP/$PARENT_SCRIPT_FILE_NAME $SCRIPT_PATH
notify-send -i "$ICON" "Helium Helper" "Script updated to $REMOTE_SCRIPT_VERSION" 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 else
echo "${DATE} | Failed to update - Malformed version tags" >> $LOG echo "$LOG_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 | 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 fi
} }
### UPDATE ### UPDATE
update_helium() { update_helium() {
DOWNLOAD_URL=$(curl -s $SOURCE_URL | grep "browser_download_url" | grep "x86_64.AppImage" | grep -v "zsync" | 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}')
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}') 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.AppImage --version | awk '{print $2}') LOCAL_VERSION=$($INSTALL_PATH/$APP_NAME.$FILE_EXTENSION --version | awk '{print $2}')
SOURCE_VERSION=$(curl -s $SOURCE_URL | grep "tag_name" | tr -d \", | awk '{print $2}') APP_SOURCE_VERSION=$(curl -s $APP_SOURCE_URL | grep "tag_name" | tr -d \", | awk '{print $2}')
### CHECK FOR EMPTY VERSION TAGS ### CHECK FOR EMPTY VERSION TAGS
if [[ -z "$SOURCE_VERSION" ]] ; then if [[ -z "$APP_SOURCE_VERSION" ]] ; then
echo "${DATE} | Failed to update - Empty version tag --> $SOURCE" >> $LOG echo "$LOG_DATE | Failed to update - Empty version tag --> $APP_SOURCE" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Browser update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit exit
elif [[ -z "$LOCAL_VERSION" ]] ; then elif [[ -z "$LOCAL_VERSION" ]] ; then
echo "${DATE} | Failed to update - Empty version tag --> LOCAL" >> $LOG echo "$LOG_DATE | Failed to update - Empty version tag --> LOCAL" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Browser update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit exit
fi fi
### COMPARE LOCAL & REMOTE VERSION ### COMPARE LOCAL & REMOTE VERSION
LOCAL_VERSION_NUM=$(echo $LOCAL_VERSION | tr -d .) 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 if [ "$APP_SOURCE_VERSION" == "$LOCAL_VERSION" ] ; then
notify-send -i "$ICON" "Helium Helper" "Browser is up-to-date" notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser is up-to-date"
elif [ "$SOURCE_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then elif [ "$APP_SOURCE_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then
mkdir -p $TMP $BACKUP_PATH mkdir -p $TMP
wget -P $TMP $DOWNLOAD_URL -q --show-progress wget -P $TMP $DOWNLOAD_URL -q
chmod +x $TMP/$SOURCE_FILENAME chmod +x $TMP/$APP_SOURCE_FILENAME
if [ -f "$BACKUP_PATH/$APP_NAME.AppImage.old" ] ; then backup_helium
rm $BACKUP_PATH/$APP_NAME.AppImage.old mv $TMP/$APP_SOURCE_FILENAME $INSTALL_PATH/$APP_NAME.$FILE_EXTENSION
fi sed -i "s|X-AppImage-Version=.*|X-AppImage-Version=$($INSTALL_PATH/$APP_NAME.$FILE_EXTENSION --version | awk '{print $2}')|" $LAUNCHER_PATH/$APP_NAME.desktop
mv $INSTALL_PATH/$APP_NAME.AppImage $BACKUP_PATH/$APP_NAME.AppImage.old echo "$LOG_DATE | $APP_NAME updated to version ${APP_SOURCE_VERSION}" >> $LOG
mv $TMP/$SOURCE_FILENAME $INSTALL_PATH/$APP_NAME.AppImage notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser updated to version $APP_SOURCE_VERSION"
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"
else else
echo "${DATE} | Failed to update - Version tags malformed" >> $LOG echo "$LOG_DATE | Failed to update - Version tags malformed" >> $LOG
notify-send -i "$ICON" "Helium Helper" "Browser update failed! See log for details" notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit exit
fi fi
@ -192,7 +289,7 @@ show_log() {
xdg-open $LOG xdg-open $LOG
else else
notify-send -i "$ICON" "Helium Helper" "No log created yet" notify-send --icon="$ICON" "$NOTIFY_NAME" "No log created yet"
fi fi
} }
@ -229,6 +326,13 @@ exit_clean() {
## GET OPTIONS ## GET OPTIONS
while getopts ":a,:s,:S,:L,:h" OPTION ; do 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 case $OPTION in
S) S)
@ -260,6 +364,9 @@ done
## DEPENDENCY CHECK ## DEPENDENCY CHECK
dependency_check dependency_check
## DE CHECK
desktop_environment
## UPDATE ## UPDATE
update_helium update_helium