Compare commits
No commits in common. "main" and "0.5.1" have entirely different histories.
9 changed files with 435 additions and 1481 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
|||
test.sh
|
||||
binaries
|
||||
102
README.md
102
README.md
|
|
@ -1,93 +1,19 @@
|
|||
# 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
|
||||
### Helium_Helper.sh
|
||||
- Interactive installer, updater & configuration script
|
||||
- Installs to `$HOME/.apps/Helium` | changeable in line 32 `INSTALL_PATH`
|
||||
- Interactive installer and updater script
|
||||
- Installs to `/home/<USER>/.apps/Helium` | changeable in line 27 `INSTALL_PATH`
|
||||
- Assumes:
|
||||
- Presence of `$HOME/.apps/Helium` when updating | changeable in line 32 `INSTALL_PATH`
|
||||
- Executable named `Helium.AppImage`
|
||||
- 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
|
||||
- View Log
|
||||
- Run `helium_helper.sh -h` for help
|
||||
---
|
||||
### Helium_Launcher_Update.sh
|
||||
- Update Helium from launcher
|
||||
- Presence of `/home/<USER>/.apps/Helium` when updating | changeable in line 27 `INSTALL_PATH`
|
||||
- Executable named `Helium.AppImage` | for convenience so launchers don't have to be edited at each update
|
||||
- Keeps prior AppImage as `Helium.old` which will be replaced at every update
|
||||
- Adds desktop launcher to `/home/<USER>/.local/share/applications`
|
||||
|
||||
### Helium_Auto_Update.sh
|
||||
- Automatic updater script
|
||||
- Installs to `/home/<USER>/.apps/Helium` | changeable in line 8 `INSTALL_PATH`
|
||||
- Assumes:
|
||||
- Presence of `$HOME/.apps/Helium` when updating | changeable in line 21 `INSTALL_PATH`
|
||||
- Executable named `Helium.AppImage`
|
||||
- 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
|
||||
|
||||
- Presence of `/home/<USER>/.apps/Helium` when updating | changeable in line 8 `INSTALL_PATH`
|
||||
- Executable named `helium-browser.AppImage` | for convenience so launchers don't have to be edited at each update
|
||||
- Loggs to `/home/<USER>/.apps/Helium/updateLog`
|
||||
- Keeps prior AppImage as `helium-browser.OldAppImage` which will be replaced at every update
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Icon=%ICON_LOCATION%
|
|||
Type=Application
|
||||
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;
|
||||
Actions=new-window;new-private-window;update;update-script;show-log;
|
||||
Actions=new-window;new-private-window;
|
||||
X-AppImage-Version=%APP_VERSION%
|
||||
|
||||
[Desktop Action new-window]
|
||||
|
|
@ -22,14 +22,3 @@ Exec=%APP_LOCATION%
|
|||
Name=New Incognito Window
|
||||
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%
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
on:
|
||||
pull_requests:
|
||||
pull_request_target:
|
||||
98
devdoc.md
98
devdoc.md
|
|
@ -1,98 +0,0 @@
|
|||
# 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
|
||||
```
|
||||
94
helium_auto_update.sh
Executable file
94
helium_auto_update.sh
Executable file
|
|
@ -0,0 +1,94 @@
|
|||
#!/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
|
||||
1161
helium_helper.sh
1161
helium_helper.sh
File diff suppressed because it is too large
Load diff
|
|
@ -1,374 +0,0 @@
|
|||
#!/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
Normal file
69
todo.md
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# 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
|
||||
#############
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue