diff --git a/assets/icon/helium.png b/assets/icon/helium.png deleted file mode 100644 index 238d157..0000000 Binary files a/assets/icon/helium.png and /dev/null differ diff --git a/config/helium.desktop b/config/helium.desktop new file mode 100644 index 0000000..ea830f9 --- /dev/null +++ b/config/helium.desktop @@ -0,0 +1,27 @@ +[Desktop Entry] +Version=1.0 +Name=Helium +GenericName=Web Browser +Comment=Access the Internet +Exec=%APP_LOCATION% %U +StartupNotify=true +StartupWMClass=helium +Terminal=false +Icon=helium +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; +X-AppImage-Version=%APP_VERSION% + +[Desktop Action new-window] +Name=New Window +Exec=%APP_LOCATION% + +[Desktop Action new-private-window] +Name=New Incognito Window +Exec=%APP_LOCATION% --incognito + +[Desktop Action update-helium] +Name=Update Helium +Exec=%SCRIPT_LOCATION% diff --git a/assets/launcher/helium.desktop.template b/config/helium.desktop.template similarity index 87% rename from assets/launcher/helium.desktop.template rename to config/helium.desktop.template index 22ea353..ea830f9 100644 --- a/assets/launcher/helium.desktop.template +++ b/config/helium.desktop.template @@ -1,13 +1,13 @@ [Desktop Entry] Version=1.0 -Name=Helium Web Browser +Name=Helium GenericName=Web Browser Comment=Access the Internet Exec=%APP_LOCATION% %U StartupNotify=true StartupWMClass=helium Terminal=false -Icon=%ICON_LOCATION% +Icon=helium 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; @@ -22,3 +22,6 @@ Exec=%APP_LOCATION% Name=New Incognito Window Exec=%APP_LOCATION% --incognito +[Desktop Action update-helium] +Name=Update Helium +Exec=%SCRIPT_LOCATION% diff --git a/assets/icon/helium-icon.png b/config/icon/helium-icon.png similarity index 100% rename from assets/icon/helium-icon.png rename to config/icon/helium-icon.png diff --git a/helium_helper.sh b/helium_helper.sh index 41249ad..8f41ba1 100755 --- a/helium_helper.sh +++ b/helium_helper.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Helium BOWSER INSTALL & UPDATE SCRIPT ---> INTERACTIVE +# HELIUM BOWSER INSTALL & UPDATE SCRIPT ---> INTERACTIVE ########## PREREQUISITES ########### @@ -11,25 +11,18 @@ RED="\e[0;31m" GRN="\e[0;32m" CRS="\e[0m" -## GLOBAL VARIABLES -APP_NAME="Helium" -APP_NAME_LONG="Helium Web Browser" -SOURCE="GitHub" -SCRIPT_NAME="$APP_NAME Helper Script" -SCRIPT_VERSION="0.5.1" -DATE=$(date) - ## LOCATIONS -TMP=/tmp/$APP_NAME -INSTALL_PATH=$HOME/.apps/$APP_NAME -CONFIG_PATH=$INSTALL_PATH/assets -BACKUP_PATH=$INSTALL_PATH/assets/backups -LOG_PATH=$INSTALL_PATH/assets/logs -LOG=$LOG_PATH/log +TMP=/tmp/Helium +INSTALL_PATH=$HOME/.apps/Helium +CONFIG_PATH=$INSTALL_PATH/config LAUNCHER_PATH=$HOME/.local/share/applications SCRIPT_PATH=$HOME/.local/bin #PROFILE=$HOME/.profile ### for AUTO UPDATE +## GLOBAL VARIABLES +SCRIPT_NAME="Helium Helper Script" +SCRIPT_VERSION="0.5.1" + ########## FUNCTIONS ########### ### DEPENDENCIES @@ -63,12 +56,12 @@ dependency_check () { ### CHECK LOCAL INSTALL local_check() { if ! [ -d "$INSTALL_PATH" ] ; then - echo -e "\n ${RED}$APP_NAME_LONG directory not found!${CRS}" + echo -e "\n ${RED}Helium directory not found!${CRS}" install_helium exit - elif ! [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then - echo -e "\n ${RED}$APP_NAME_LONG directory found but no executable named ${CYN}$APP_NAME.AppImage${RED}!${CRS}" + elif ! [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then + echo -e "\n ${RED}Helium directory found but no executable named ${CYN}helium-browser.AppImage${RED}!${CRS}" install_helium exit @@ -77,24 +70,25 @@ local_check() { ### INSTALL install_helium() { - if [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then - echo -e "\n ${CYN}$APP_NAME_LONG AppImage found! Trying to update...${CRS}" + if [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then + echo -e "\n ${CYN}Helium AppImage found! Trying to update...${CRS}" update_helium exit fi while true ; do - read -p " Download and install $APP_NAME_LONG from $SOURCE? (Y/n) : " CONFIRM_INSTALL + read -p " Download and install Helium from GitHub? (Y/n) : " CONFIRM_INSTALL if [[ "$CONFIRM_INSTALL" == "" || "$CONFIRM_INSTALL" == "y" || "$CONFIRM_INSTALL" == "Y" ]] ; then 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}') + mkdir -p $TMP wget -P $TMP $GIT_URL -q --show-progress chmod +x $TMP/$GIT_FILENAME mkdir -p $INSTALL_PATH - mv $TMP/$GIT_FILENAME $INSTALL_PATH/$APP_NAME.AppImage - echo -e "\n ${GRN}$APP_NAME_LONG is installed!${CRS}\n" + mv $TMP/$GIT_FILENAME $INSTALL_PATH/helium-browser.AppImage + echo -e "\n ${GRN}Helium is installed!${CRS}\n" exit elif [[ "$CONFIRM_INSTALL" == "n" || "$CONFIRM_INSTALL" == "N" ]] ; then @@ -111,55 +105,25 @@ install_helium() { ### LAUNCHER --> TO DO add_launcher() { - if [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then - while true ; do - read -p " Add $APP_NAME_LONG launcher to $LAUNCHER_PATH? (Y/n) : " CONFIRM_LAUNCHER - - if [[ "$CONFIRM_LAUNCHER" == "" || "$CONFIRM_LAUNCHER" == "y" || "$CONFIRM_LAUNCHER" == "Y" ]] ; then - ASSET_URL=https://lab.c95.org/fr4nz/helium-helper/src/branch/main/assets - LOCAL_VERSION=$($INSTALL_PATH/$APP_NAME.AppImage --version | awk '{print $2}') - wget -P $TMP $ASSET_URL -q --show-progress - sed -i "s|%APP_LOCATION%|$INSTALL_PATH/$APP_NAME.AppImage|" $TMP/assets/launcher/helium.desktop.template - sed -i "s|%ICON_LOCATION%|$INSTALL_PATH/$CONFIG_PATH/icon/helium.png|" $TMP/assets/launcher/helium.desktop.template - sed -i "s|%APP_VERSION%|$LOCAL_VERSION|" $TMP/assets/launcher/helium.desktop.template - mkdir -p $LAUNCHER_PATH - mv $TMP/assets/launcher/helium.desktop.template $LAUNCHER_PATH/$APP_NAME.desktop - rm $TMP/assets/launcher - mv $TMP/assets $CONFIG_PATH - echo -e "\n ${GRN}$APP_NAME_LONG launcher is set up!${CRS}\n" - exit - - elif [[ "$CONFIRM_LAUNCHER" == "n" || "$CONFIRM_LAUNCHER" == "N" ]] ; then - echo -e "\n ${RED}Launcher creation cancelled!${CRS}\n" - exit - - else - echo -e " ${YEL}Invalid response!${CRS}\n" - - fi - - done - - elif [ -f "$LAUNCHER_PATH/$APP_NAME.desktop" ] ; then - echo -e "\n ${RED}${APP_NAME}.desktop already exists!${CRS}" + if ! [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then + echo -e "\n ${RED}Helium AppImage not found! Can't add launcher...${CRS}" exit - + else - echo -e "\n ${RED}$APP_NAME_LONG AppImage not found! Can't add launcher...${CRS}" - install_helium + echo -e "\n ${RED}Not implemented yet...${CRS}" exit - + fi } ### UPDATE update_helium() { - LOCAL_VERSION=$($INSTALL_PATH/$APP_NAME.AppImage --version | awk '{print $2}') + LOCAL_VERSION=$($INSTALL_PATH/helium-browser.AppImage --version | awk '{print $2}') GIT_VERSION=$(curl -s https://api.github.com/repos/imputnet/helium-linux/releases/latest | grep "tag_name" | tr -d \", | awk '{print $2}') ### CHECK FOR EMPTY VERSION TAGS if [ -z "$GIT_VERSION" ] ; then - echo -e "\n ${RED}Empty version tag from ${CYN}$SOURCE${RED}! Can't compare, exiting...${CRS}" + echo -e "\n ${RED}Empty version tag from ${CYN}GitHub${RED}! Can't compare, exiting...${CRS}" exit elif [ -z "$LOCAL_VERSION" ] ; then @@ -173,15 +137,15 @@ update_helium() { GIT_VERSION_NUM=$(echo $GIT_VERSION | tr -d .) if [ "$GIT_VERSION" == "$LOCAL_VERSION" ] ; then - echo -e "\n ${GRN}$APP_NAME_LONG is already up-to-date!${CRS}\n" + echo -e "\n ${GRN}Helium is already up-to-date!${CRS}\n" elif [ "$GIT_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then - echo -e "\n ${RED}$APP_NAME_LONG is updatable!${CRS}\n" + echo -e "\n ${RED}Helium is updatable!${CRS}\n" echo -e " ${CYN}Local Version :\t${CRS}${LOCAL_VERSION}" - echo -e " ${CYN}$SOURCE Version :\t${CRS}${GIT_VERSION}\n" + echo -e " ${CYN}GitHub Version :\t${CRS}${GIT_VERSION}\n" while true ; do - read -p " Download and update $APP_NAME_LONG from $SOURCE? (Y/n) : " CONFIRM + read -p " Download and update Helium from GitHub? (Y/n) : " CONFIRM if [[ "$CONFIRM" == "" || "$CONFIRM" == "y" || "$CONFIRM" == "Y" ]] ; then 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}') @@ -189,12 +153,12 @@ update_helium() { mkdir -p $TMP wget -P $TMP $GIT_URL -q --show-progress chmod +x $TMP/$GIT_FILENAME - if [ -f "$INSTALL_PATH/$APP_NAME.old" ] ; then - rm $INSTALL_PATH/$APP_NAME.old + if [ -f "$INSTALL_PATH/helium-browser.OldAppImage" ] ; then + rm $INSTALL_PATH/helium-browser.OldAppImage fi - mv $INSTALL_PATH/$APP_NAME.AppImage $INSTALL_PATH/$APP_NAME.old - mv $TMP/$GIT_FILENAME $INSTALL_PATH/$APP_NAME.AppImage - echo -e "\n ${GRN}$APP_NAME_LONG is up-to-date !${CRS}\n" + mv $INSTALL_PATH/helium-browser.AppImage $INSTALL_PATH/helium-browser.Old + mv $TMP/$GIT_FILENAME $INSTALL_PATH/helium-browser.AppImage + echo -e "\n ${GRN}Helium is up-to-date !${CRS}\n" break elif [[ "$CONFIRM" == "n" || "$CONFIRM" == "N" ]] ; then @@ -211,7 +175,7 @@ update_helium() { else echo -e "\n ${RED}Version tags malformed or you are using a Beta version!${CRS}\n" echo -e " ${CYN}Local Version :\t${CRS}${LOCAL_VERSION}" - echo -e " ${CYN}$SOURCE Version :\t${CRS}${GIT_VERSION}\n" + echo -e " ${CYN}GitHub Version :\t${CRS}${GIT_VERSION}\n" echo -e " ${RED}Update failed... Exiting...${CRS}\n" exit @@ -221,8 +185,8 @@ update_helium() { ### AUTOMATIC UPDATE --> TO DO auto_update() { - if ! [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then - echo -e "\n ${RED}$APP_NAME AppImage not found! Can't add auto update script...${CRS}" + if ! [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then + echo -e "\n ${RED}Helium AppImage not found! Can't add auto update script...${CRS}" exit else @@ -237,11 +201,11 @@ remove_helium() { if [ -d "$INSTALL_PATH" ] ; then while true ; do - read -p " Remove $APP_NAME_LONG folder $INSTALL_PATH? (Y/n) : " CONFIRM_REMOVE + read -p " Remove Helium folder ${INSTALL_PATH}? (Y/n) : " CONFIRM_REMOVE if [[ "$CONFIRM_REMOVE" == "" || "$CONFIRM_REMOVE" == "y" || "$CONFIRM_REMOVE" == "Y" ]] ; then rm -rf $INSTALL_PATH - echo -e "\n ${RED}$APP_NAME_LONG removed!${CRS}\n" + echo -e "\n ${RED}Helium removed!${CRS}\n" exit elif [[ "$CONFIRM_REMOVE" == "n" || "$CONFIRM_REMOVE" == "N" ]] ; then @@ -256,7 +220,7 @@ remove_helium() { done else - echo -e "\n ${RED}Can't remove $APP_NAME_LONG! ${YEL}$INSTALL_PATH ${RED}directory not found...${CRS}\n" + echo -e "\n ${RED}Can't remove Helium! ${YEL}${INSTALL_PATH} ${RED}directory not found...${CRS}\n" exit fi @@ -264,15 +228,15 @@ remove_helium() { ### SCRIPT VERSION script_version() { - echo -e "\n ${CYN}$APP_NAME_LONG Helper Script Version : ${GRN}${SCRIPT_VERSION}${CRS}\n" + echo -e "\n ${CYN}Helium Helper Script Version : ${GRN}${SCRIPT_VERSION}${CRS}\n" exit } ### UPDATE SCRIPT --> TO DO update_script() { - if ! [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then - echo -e "\n ${RED}$APP_NAME_LONG AppImage not found! Can't update script...${CRS}" + if ! [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then + echo -e "\n ${RED}Helium AppImage not found! Can't update script...${CRS}" exit else @@ -284,12 +248,12 @@ update_script() { ### COMPARE APPIMAGE VERSION compare_version() { - LOCAL_VERSION=$($INSTALL_PATH/$APP_NAME.AppImage --version | awk '{print $2}' >/dev/null 2>&1) + LOCAL_VERSION=$($INSTALL_PATH/helium-browser.AppImage --version | awk '{print $2}') GIT_VERSION=$(curl -s https://api.github.com/repos/imputnet/helium-linux/releases/latest | grep "tag_name" | tr -d \", | awk '{print $2}') ### CHECK FOR EMPTY VERSION TAGS if [ -z "$GIT_VERSION" ] ; then - echo -e "\n ${RED}Empty version tag from ${CYN}$SOURCE${RED}! Can't compare, exiting...${CRS}" + echo -e "\n ${RED}Empty version tag from ${CYN}GitHub${RED}! Can't compare, exiting...${CRS}" exit elif [ -z "$LOCAL_VERSION" ] ; then @@ -303,21 +267,21 @@ compare_version() { GIT_VERSION_NUM=$(echo $GIT_VERSION | tr -d .) if [ "$GIT_VERSION" == "$LOCAL_VERSION" ] ; then - echo -e "\n ${GRN}$APP_NAME_LONG is up-to-date!${CRS}\n" + echo -e "\n ${GRN}Helium is up-to-date!${CRS}\n" echo -e " ${CYN}Local Version :\t${CRS}${LOCAL_VERSION}" - echo -e " ${CYN}$SOURCE Version :\t${CRS}${GIT_VERSION}\n" + echo -e " ${CYN}GitHub Version :\t${CRS}${GIT_VERSION}\n" exit elif [ "$GIT_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then - echo -e "\n ${YEL}$APP_NAME_LONG is updatable!${CRS}\n" + echo -e "\n ${YEL}Helium is updatable!${CRS}\n" echo -e " ${CYN}Local Version :\t${CRS}${LOCAL_VERSION}" - echo -e " ${CYN}$SOURCE Version :\t${CRS}${GIT_VERSION}\n" + echo -e " ${CYN}GitHub Version :\t${CRS}${GIT_VERSION}\n" exit else echo -e "\n ${RED}Version tags malformed or you are using a Beta version!${CRS}\n" echo -e " ${CYN}Local Version :\t${CRS}${LOCAL_VERSION}" - echo -e " ${CYN}$SOURCE Version :\t${CRS}${GIT_VERSION}\n" + echo -e " ${CYN}GitHub Version :\t${CRS}${GIT_VERSION}\n" echo -e " ${RED}Update failed ... Exiting ...${CRS}\n" exit @@ -327,14 +291,14 @@ compare_version() { ### HELP help() { echo -e "\n${CYN}${SCRIPT_NAME}${CRS}\n" - echo -e "$APP_NAME_LONG installer & updater script\n" - echo -e "Syntax: ${APP_NAME}_helper.sh [ -i | -L | -u | -U | -r | -c | -s | -S | -h ]\n" + echo -e "Helium Browser installer & updater script\n" + echo -e "Syntax: helium_helper.sh [ -i | -L | -u | -U | -r | -c | -s | -S | -h ]\n" echo -e "Options:\n" - echo -e "\t-i\tDownload & install $APP_NAME_LONG from $SOURCE" + echo -e "\t-i\tDownload & install Helium from GitHub" echo -e "\t-L\tCreate desktop launcher ${RED}--> Not yet working${CRS}" - echo -e "\t-u\tDownload & update $APP_NAME_LONG from $SOURCE" + echo -e "\t-u\tDownload & update Helium from GitHub" echo -e "\t-U\tEnable automatic updates on login ${RED}--> Not yet working${CRS}" - echo -e "\t-r\tRemove $APP_NAME_LONG" + echo -e "\t-r\tRemove Helium" echo -e "\t-c\tCompare local to remote version" echo -e "\t-s\tShow script version" echo -e "\t-S\tUpdate script ${RED}--> Not yet working${CRS}" @@ -361,25 +325,22 @@ exit_clean() { while getopts ":i,:L,:u,:U,:r,:c,:s,:S,:h" OPTION ; do case $OPTION in i) - echo -e "\n ${YEL}Installing $APP_NAME_LONG...${CRS}" + echo -e "\n ${YEL}Installing Helium Browser...${CRS}" dependency_check - local_check install_helium exit_clean exit ;; L) - echo -e "\n ${YEL}Adding $APP_NAME_LONG launcher...${CRS}" + echo -e "\n ${YEL}Adding Helium Browser launcher...${CRS}" dependency_check - local_check add_launcher exit_clean exit ;; u) - echo -e "\n ${YEL}Updating $APP_NAME_LONG...${CRS}" + echo -e "\n ${YEL}Updating Helium Browser...${CRS}" dependency_check - local_check update_helium exit_clean exit ;; @@ -387,20 +348,18 @@ while getopts ":i,:L,:u,:U,:r,:c,:s,:S,:h" OPTION ; do U) echo -e "\n ${YEL}Enabling automatic updates...${CRS}" dependency_check - local_check auto_update exit_clean exit ;; r) - echo -e "\n ${YEL}Removing $APP_NAME_LONG...${CRS}" + echo -e "\n ${YEL}Removing Helium Browser...${CRS}" remove_helium exit ;; c) echo -e "\n ${YEL}Comparing remote to local version...${CRS}" dependency_check - local_check compare_version exit_clean exit ;; @@ -412,7 +371,6 @@ while getopts ":i,:L,:u,:U,:r,:c,:s,:S,:h" OPTION ; do S) echo -e "\n ${YEL}Updating script...${CRS}" dependency_check - local_check update_script exit_clean exit ;; diff --git a/todo.md b/todo.md index da806f5..8a1350a 100644 --- a/todo.md +++ b/todo.md @@ -16,8 +16,6 @@ - Internet connectivity check in [Auto Update Script](https://lab.c95.org/fr4nz/helium-helper/src/branch/main/helium_auto_update.sh) - Desktop entry [Helper Script](https://lab.c95.org/fr4nz/helium-helper/src/branch/main/helium_helper.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