Compare commits

...

106 commits
0.5.1 ... 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
0bdf836eb3 Readme update 2025-12-27 15:21:24 +01:00
f79c997f16 Alias removed 2025-12-27 15:17:22 +01:00
5aa8ee1915 Readme update 2025-12-27 15:17:00 +01:00
c1ec805b1b Version bumped up 2025-12-27 14:25:16 +01:00
99755d40fc update 2025-12-27 13:10:09 +01:00
1a3927e689 Logging changed 2025-12-27 13:05:22 +01:00
a97e77a370 Fixed SED command 2025-12-27 12:58:40 +01:00
f072d0608c update 2025-12-27 12:52:09 +01:00
62d0671f03 Fixed missing variable 2025-12-27 12:51:52 +01:00
4f1d453e9e More accessible url variables 2025-12-27 12:34:17 +01:00
d1da40494b Log view function extended 2025-12-27 12:07:28 +01:00
9586095f86 Log View added; Removal extended 2025-12-27 11:53:59 +01:00
f42029b0f6 Log view function added 2025-12-27 11:53:18 +01:00
57c0770950 Fixed missing variable 2025-12-27 11:01:30 +01:00
6dccf9c1e4 Remote script check simplified; Icon added to desktop notification 2025-12-27 10:51:11 +01:00
2f8d7b8246 Remote script check simplified 2025-12-27 10:50:45 +01:00
69378db024 update 2025-12-27 00:01:25 +01:00
e394371b2c update 2025-12-26 23:52:12 +01:00
a03f59d3ee Launcher option added 2025-12-26 23:46:17 +01:00
5ad81a5997 Desktop notifications added 2025-12-26 23:34:50 +01:00
4a6741f581 Alias remover added 2025-12-26 22:34:10 +01:00
5e26f8e43b Version bumped 2025-12-26 22:14:42 +01:00
70a5db2ba2 -U option removed 2025-12-26 22:12:20 +01:00
a0ac02743a Alias refined 2025-12-26 22:10:11 +01:00
5a0913a29a update 2025-12-26 21:56:44 +01:00
0eec37352a add alias fixed 2025-12-24 14:41:06 +01:00
3bc94234cf add launcher fixed 2025-12-24 14:27:44 +01:00
932856401c add alias fixed 2025-12-24 14:19:07 +01:00
d962b1b1f0 Minor changes 2025-12-24 14:07:28 +01:00
238e02e8aa Minor changes 2025-12-24 14:02:56 +01:00
234df445f8 Minor changes 2025-12-24 13:59:53 +01:00
1c7c7163d0 Minor changes 2025-12-24 13:55:36 +01:00
d435cdb276 Minor changes 2025-12-24 13:53:16 +01:00
aa1e3831db To Do updated 2025-12-24 13:05:33 +01:00
0cf476a686 Readme & To Do updated 2025-12-24 13:03:16 +01:00
d65799e4a8 Alias for bashrc added 2025-12-24 11:24:52 +01:00
14b7be590a Minor changes 2025-12-24 11:19:53 +01:00
7203078768 Script updater extended 2025-12-24 11:11:25 +01:00
08ce780cee Minor changes 2025-12-24 10:57:28 +01:00
b4f3ea4e97 to do updated 2025-12-24 10:54:06 +01:00
3cbcd74f06 Launcher option added 2025-12-24 10:48:01 +01:00
1e88190670 Minor changes 2025-12-24 00:35:49 +01:00
4b041ff1d6 Structure change 2025-12-24 00:34:47 +01:00
d8392feac7 Alias for zsh working 2025-12-23 23:07:17 +01:00
0d99d8e325 update 2025-12-23 20:21:29 +01:00
b196c5104f Script updater ready for testing 2025-12-23 18:00:10 +01:00
c00811622c Typo fixed 2025-12-23 17:48:33 +01:00
f56c1ac3ea Script updater added 2025-12-23 17:47:06 +01:00
fe0546542f Output cleanup 2025-12-23 11:55:03 +01:00
a36f13a742 Launcher updater added 2025-12-23 00:54:23 +01:00
46b534fa48 to do updated 2025-12-23 00:15:33 +01:00
ebb5c25de6 to do updated 2025-12-23 00:15:24 +01:00
7717c5932c Post merge changes 2025-12-22 19:37:03 +01:00
9 changed files with 1458 additions and 412 deletions

2
.gitignore vendored Normal file
View file

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

102
README.md
View file

@ -1,19 +1,93 @@
# Helium Bowser installer & updater # 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. 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 and updater script - Interactive installer, updater & configuration script
- Installs to `/home/<USER>/.apps/Helium` | changeable in line 27 `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 27 `INSTALL_PATH` - Presence of `$HOME/.apps/Helium` when updating | changeable in line 32 `INSTALL_PATH`
- Executable named `Helium.AppImage` | for convenience so launchers don't have to be edited at each update - Executable named `Helium.AppImage`
- Keeps prior AppImage as `Helium.old` which will be replaced at every update - Keeps backup archives from
- Adds desktop launcher to `/home/<USER>/.local/share/applications` - `Helium.AppImage`
- `helium_helper.sh`
### Helium_Auto_Update.sh - `helium_launcher_update.sh`
- Automatic updater script - `Helium.desktop`
- Installs to `/home/<USER>/.apps/Helium` | changeable in line 8 `INSTALL_PATH` - `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
- View Log
- Run `helium_helper.sh -h` for help
---
### Helium_Launcher_Update.sh
- Update Helium from launcher
- Assumes: - Assumes:
- Presence of `/home/<USER>/.apps/Helium` when updating | changeable in line 8 `INSTALL_PATH` - Presence of `$HOME/.apps/Helium` when updating | changeable in line 21 `INSTALL_PATH`
- Executable named `helium-browser.AppImage` | for convenience so launchers don't have to be edited at each update - Executable named `Helium.AppImage`
- Loggs to `/home/<USER>/.apps/Helium/updateLog` - Loggs to `$HOME/.apps/Helium/assets/logs`
- Keeps prior AppImage as `helium-browser.OldAppImage` which will be replaced at every update - 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
&nbsp;

View file

@ -11,7 +11,7 @@ Icon=%ICON_LOCATION%
Type=Application Type=Application
Categories=Network;WebBrowser; Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https; MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;
Actions=new-window;new-private-window; Actions=new-window;new-private-window;update;update-script;show-log;
X-AppImage-Version=%APP_VERSION% X-AppImage-Version=%APP_VERSION%
[Desktop Action new-window] [Desktop Action new-window]
@ -22,3 +22,14 @@ Exec=%APP_LOCATION%
Name=New Incognito Window Name=New Incognito Window
Exec=%APP_LOCATION% --incognito Exec=%APP_LOCATION% --incognito
[Desktop Action update]
Name=Update Helium
Exec=%QUIET_UPDATE_SCRIPT%
[Desktop Action update-script]
Name=Update Helium Helper
Exec=%SCRIPT_UPDATE%
[Desktop Action show-log]
Name=Show Update Log
Exec=%OPEN_LOG_EDITOR%

View file

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

98
devdoc.md Normal file
View file

@ -0,0 +1,98 @@
# To Do List Helium installer
## Last Jobs
- Readme updated
- Desktop Entry updater --> Complete
- Launcher has an update option now
- Launcher installer refined
- Clean Up
---
- Script updater
- Remote script check simplified
- Remover function extended
- Alias remover added
- Script remover added
- helium_auto_update.sh renamed to helium_launcher_update.sh
- Desktop notifications added
- Launcher functions extended
- Update script option added
- 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
- Roll back from backup
- Update Readme
- Make functional launcher optional
- Variable transfer script
## Repo
- Merge workflow
- Convert URLs from __main__ to __stable__
- Remove to do list
- Remove comment from script
## Fix
## Notes
- Auto Update
```sh
while true ; do
read -p " Enable automatic update check on login? (y/N) : " AUTO_UPDATE
if [[ "$AUTO_UPDATE" == "" || "$AUTO_UPDATE" == "n" || "$AUTO_UPDATE" == "N" ]] ; then
break
elif [[ "$AUTO_UPDATE" == "y" || "$AUTO_UPDATE" == "Y" ]] ; then
if ! [ -f "$PROFILE" ] ; then
echo -e "\n ${RED}Following file is missing :\n\n${YEL}$PROFILE\n\n ${CYN}Please investigate and re-run script !${CRS}"
exit 1
else
wget -P $TMP https://lab.c95.org/fr4nz/shell-scripts/src/branch/main/helium-browser/helium_auto_update.sh -q --show-progress
chmod +x $TMP/helium_auto_update.sh
mv $TMP/helium_auto_update.sh $INSTALL_PATH/helium_auto_update.sh
echo >> $PROFILE
echo "### HELIUM AUTO UPDATE ###" >> $PROFILE
echo "${INSTALL_PATH}/helium_auto_update.sh" >> $PROFILE
echo >> $PROFILE
echo -e "\n ${GRN}Automatic updates enabled ! ${CRS}\n"
break
fi
else
echo -e " ${YEL}Invalid response !${CRS}\n"
fi
done
```

View file

@ -1,94 +0,0 @@
#!/bin/bash
# HELIUM BOWSER AUTO UPDATE SCRIPT WITH LOGGING
## VARIABLES & TMP FOLDER
mkdir -p /tmp/Helium
TMP=/tmp/Helium
INSTALL_PATH=$HOME/.apps/Helium
LOG=$INSTALL_PATH/updateLog
DEPENDENCIES=("curl" "wget")
MISSING=$(cat $TMP/missingDeps 2>/dev/null)
GIT_VERSION=$(curl -s https://api.github.com/repos/imputnet/helium-linux/releases/latest | grep "tag_name" | tr -d \", | awk '{print $2}')
LOCAL_VERSION=$($INSTALL_PATH/helium-browser.AppImage --version | awk '{print $2}')
DATE=$(date)
## CHECKS
if ! [ -d "$INSTALL_PATH" ] ; then
mkdir -p $INSTALL_PATH
echo "${DATE} | Failed to update - Helium installation path not present - But created for logging" >> $LOG
exit 1
elif ! [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then
echo "${DATE} | Failed to update - Local Helium AppImage not found" >> $LOG
exit 1
else
:
fi
### SCRIPT DEPENDENCIES
dependency_check() {
local PACKAGE="$1"
if command -v "$PACKAGE" >/dev/null 2>&1 ; then
:
else
echo "$PACKAGE" >>$TMP/missingDeps
fi
}
for PACKAGE in "${DEPENDENCIES[@]}" ; do
dependency_check "$PACKAGE"
done
if ! [ "$MISSING" ] ; then
:
else
echo "${DATE} | Failed to update - missing dependencies : $MISSING" >> $LOG
exit 1
fi
## COMPARE VERSIONS
update_helium() {
GIT_URL=$(curl -s https://api.github.com/repos/imputnet/helium-linux/releases/latest | grep "browser_download_url" | grep "x86_64.AppImage" | grep -v "zsync" | tr -d \" | awk '{print $2}')
GIT_FILENAME=$(curl -s https://api.github.com/repos/imputnet/helium-linux/releases/latest | grep "browser_download_url" | grep "x86_64.AppImage" | grep -v "zsync" | tr -d \" | awk '{print $2}' | awk -F'/' '{print $9}')
wget -P $TMP $GIT_URL -q
chmod +x $TMP/$GIT_FILENAME
rm $INSTALL_PATH/helium-browser.OldAppImage >/dev/null 2>&1
mv $INSTALL_PATH/helium-browser.AppImage $INSTALL_PATH/helium-browser.OldAppImage >/dev/null 2>&1
mv $TMP/$GIT_FILENAME $INSTALL_PATH/helium-browser.AppImage
echo "${DATE} | Helium updated to ${GIT_VERSION}" >> $LOG
}
### CHECK FOR EMPTY VERSION TAGS
if [[ -z "$GIT_VERSION" ]] ; then
echo "${DATE} | Failed to update - Emty version tag --> GIT" >> $LOG
exit 1
elif [[ -z "$LOCAL_VERSION" ]] ; then
echo "${DATE} | Failed to update - Emty version tag --> LOCAL" >> $LOG
exit 1
else
:
fi
if [[ "$GIT_VERSION" == "$LOCAL_VERSION" ]] ; then
:
else
update_helium
fi
rm -rf $TMP
exit 0

File diff suppressed because it is too large Load diff

374
helium_launcher_update.sh Executable file
View file

@ -0,0 +1,374 @@
#!/bin/bash
# HELIUM BOWSER AUTO UPDATE SCRIPT WITH LOGGING
########## PREREQUISITES ###########
set -e
## GLOBAL VARIABLES
APP_NAME="Helium"
APP_NAME_LONG="Helium Web Browser"
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.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
LOG=$LOG_PATH/log
LAUNCHER_PATH=$HOME/.local/share/applications
ICON=$ASSET_PATH/icon/helium.png
SCRIPT_PATH=$HOME/.local/bin
## REMOTE LOCATIONS
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
APP_SOURCE_URL=https://api.github.com/repos/imputnet/helium-linux/releases/latest
########## FUNCTIONS ###########
### DEPENDENCIES
cmd_query() {
local PACKAGE="$1"
if ! command -v "$PACKAGE" >/dev/null 2>&1 ; then
echo " - $PACKAGE" >> $TMP/missingDeps
fi
}
dependency_check () {
DEPENDENCIES=("curl" "wget")
mkdir -p $TMP
for PACKAGE in "${DEPENDENCIES[@]}" ; do
cmd_query "$PACKAGE"
done
if ! [ -f "$LOG" ] ; then
mkdir -p $LOG_PATH
echo "########## $APP_NAME_LONG update log ##########" >> $LOG
echo >> $LOG
echo "$LOG_DATE | Log created" >> $LOG
fi
if [ -f "$TMP/missingDeps" ] ; then
MISSING=$(cat $TMP/missingDeps)
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 "$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.$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 "$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
REMOTE_SCRIPT_VERSION=$(curl -s $REMOTE_SCRIPT_URL | grep -m 1 "SCRIPT_VERSION" | tr -d 'SCRIPT_VERSION="')
### CHECK FOR EMPTY VERSION TAGS
if [ -z "$SCRIPT_VERSION" ] ; then
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 "$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
### COMPARE LOCAL & REMOTE VERSION
SCRIPT_VERSION_NUM=$(echo $SCRIPT_VERSION | tr -d .)
REMOTE_SCRIPT_VERSION_NUM=$(echo $REMOTE_SCRIPT_VERSION | tr -d .)
if [ "$REMOTE_SCRIPT_VERSION" == "$SCRIPT_VERSION" ] ; then
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
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 "$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 $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 "$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 "$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 .)
APP_SOURCE_VERSION_NUM=$(echo $APP_SOURCE_VERSION | tr -d .)
if [ "$APP_SOURCE_VERSION" == "$LOCAL_VERSION" ] ; then
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser is up-to-date"
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 "$LOG_DATE | Failed to update - Version tags malformed" >> $LOG
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit
fi
}
### SCRIPT VERSION
script_version() {
echo -e "\n ${CYN}$APP_NAME_LONG Auto Update Script Version :${CRS} $SCRIPT_VERSION\n"
}
### SHOW LOG
show_log() {
if [ -f "$LOG" ] ; then
xdg-open $LOG
else
notify-send --icon="$ICON" "$NOTIFY_NAME" "No log created yet"
fi
}
### HELP
help() {
echo -e "\n${LCY}$SCRIPT_NAME${CRS}\n"
echo -e "$APP_NAME_LONG launcher updater script\n"
echo -e "Description: Add functionality to $APP_NAME_LONG's launcher\n"
echo -e "Syntax: $SCRIPT_FILE_NAME [ -s | -S | -L | -h ]\n"
echo -e "Options:\n"
echo -e "\t-s\tShow script version"
echo -e "\t-S\tUpdate $SCRIPT_FILE_NAME"
echo -e "\t-L\tOpen log in default text editor"
echo -e "\t-h\tPrint this help page.\n"
echo -e "Configured locations:\n"
echo -e "\t${CYN}$INSTALL_PATH${CRS}\t\tInstall location"
echo -e "\t${CYN}$LOG_PATH${CRS}\tLog location"
echo -e "\t${CYN}$LAUNCHER_PATH${CRS}\tLauncher location"
echo -e "\t${CYN}$SCRIPT_PATH${CRS}\t\t\tScript location\n"
}
### EXIT CLEAN
exit_clean() {
if [ -d "$TMP" ] ; then
rm -rf $TMP
fi
exit
}
########## MAIN ##########
## 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)
dependency_check
update_script
exit_clean ;;
s)
script_version
exit_clean ;;
L)
show_log
exit_clean ;;
h)
help
exit_clean ;;
*)
echo -e "\n${YEL}Option ${RED}$1${YEL} not recognized... Refer to help below!${CRS}"
help
exit_clean ;;
esac
done
## DEPENDENCY CHECK
dependency_check
## DE CHECK
desktop_environment
## UPDATE
update_helium
## CLEAN
exit_clean

69
todo.md
View file

@ -1,69 +0,0 @@
# To Do List Helium installer
## Last Jobs
- Improved Version comparasing
- Clean up function added
- Remover function added
- Dummy functions added for:
- Auto Update
- Script update
- Dependency check fixed
- Launcher function works
- Remover extended
- Readme updated
## Add
- Internet connectivity check in [Auto Update Script](https://lab.c95.org/fr4nz/helium-helper/src/branch/main/helium_auto_update.sh)
- Desktop entry updater [Helper Script](https://lab.c95.org/fr4nz/helium-helper/src/branch/main/helium_helper.sh) & [Auto Update Script](https://lab.c95.org/fr4nz/helium-helper/src/branch/main/helium_auto_update.sh)
- Auto update setup
- shell recognition
- Script updater
- Architecture detection
- Uninstaller --> Partially done
- Set alias
## Repo
- Merge workflow
- Convert URLs from __main__ to __stable__
- Remove to do list
- Remove comment from script
## Fix
## Notes
```sh
############# TO DO
while true ; do
read -p " Enable automatic update check on login? (y/N) : " AUTO_UPDATE
if [[ "$AUTO_UPDATE" == "" || "$AUTO_UPDATE" == "n" || "$AUTO_UPDATE" == "N" ]] ; then
break
elif [[ "$AUTO_UPDATE" == "y" || "$AUTO_UPDATE" == "Y" ]] ; then
if ! [ -f "$PROFILE" ] ; then
echo -e "\n ${RED}Following file is missing :\n\n${YEL}$PROFILE\n\n ${CYN}Please investigate and re-run script !${CRS}"
exit 1
else
wget -P $TMP https://lab.c95.org/fr4nz/shell-scripts/src/branch/main/helium-browser/helium_auto_update.sh -q --show-progress
chmod +x $TMP/helium_auto_update.sh
mv $TMP/helium_auto_update.sh $INSTALL_PATH/helium_auto_update.sh
echo >> $PROFILE
echo "### HELIUM AUTO UPDATE ###" >> $PROFILE
echo "${INSTALL_PATH}/helium_auto_update.sh" >> $PROFILE
echo >> $PROFILE
echo -e "\n ${GRN}Automatic updates enabled ! ${CRS}\n"
break
fi
else
echo -e " ${YEL}Invalid response !${CRS}\n"
fi
done
#############
```