Add Launcher function implemented
This commit is contained in:
parent
b67067fccf
commit
5910d664d4
3 changed files with 45 additions and 61 deletions
|
|
@ -3,12 +3,14 @@
|
|||
# Helium BOWSER INSTALL & UPDATE SCRIPT ---> INTERACTIVE
|
||||
|
||||
########## PREREQUISITES ###########
|
||||
set -e
|
||||
|
||||
## SOME COLOR
|
||||
CYN="\e[0;36m"
|
||||
YEL="\e[0;33m"
|
||||
RED="\e[0;31m"
|
||||
GRN="\e[0;32m"
|
||||
LCY="\e[1;36m"
|
||||
CRS="\e[0m"
|
||||
|
||||
## GLOBAL VARIABLES
|
||||
|
|
@ -23,7 +25,7 @@ DATE=$(date)
|
|||
TMP=/tmp/$APP_NAME
|
||||
INSTALL_PATH=$HOME/.apps/$APP_NAME
|
||||
CONFIG_PATH=$INSTALL_PATH/assets
|
||||
BACKUP_PATH=$INSTALL_PATH/assets/backups
|
||||
BACKUP_PATH=$INSTALL_PATH/assets/backup
|
||||
LOG_PATH=$INSTALL_PATH/assets/logs
|
||||
LOG=$LOG_PATH/log
|
||||
LAUNCHER_PATH=$HOME/.local/share/applications
|
||||
|
|
@ -86,6 +88,7 @@ install_helium() {
|
|||
|
||||
while true ; do
|
||||
read -p " Download and install $APP_NAME_LONG from $SOURCE? (Y/n) : " CONFIRM_INSTALL
|
||||
echo
|
||||
|
||||
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}')
|
||||
|
|
@ -95,7 +98,8 @@ install_helium() {
|
|||
mkdir -p $INSTALL_PATH
|
||||
mv $TMP/$GIT_FILENAME $INSTALL_PATH/$APP_NAME.AppImage
|
||||
echo -e "\n ${GRN}$APP_NAME_LONG is installed!${CRS}\n"
|
||||
exit
|
||||
add_launcher
|
||||
exit_clean
|
||||
|
||||
elif [[ "$CONFIRM_INSTALL" == "n" || "$CONFIRM_INSTALL" == "N" ]] ; then
|
||||
echo -e "\n ${RED}Installation cancelled!${CRS}\n"
|
||||
|
|
@ -111,23 +115,30 @@ install_helium() {
|
|||
|
||||
### LAUNCHER --> TO DO
|
||||
add_launcher() {
|
||||
if [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then
|
||||
if [ -f "$LAUNCHER_PATH/$APP_NAME.desktop" ] ; then
|
||||
echo -e "\n ${RED}${APP_NAME}.desktop already exists!${CRS}"
|
||||
exit
|
||||
|
||||
elif [ -f "$INSTALL_PATH/$APP_NAME.AppImage" ] ; then
|
||||
while true ; do
|
||||
read -p " Add $APP_NAME_LONG launcher to $LAUNCHER_PATH? (Y/n) : " CONFIRM_LAUNCHER
|
||||
echo
|
||||
|
||||
if [[ "$CONFIRM_LAUNCHER" == "" || "$CONFIRM_LAUNCHER" == "y" || "$CONFIRM_LAUNCHER" == "Y" ]] ; then
|
||||
ASSET_URL=https://lab.c95.org/fr4nz/helium-helper/src/branch/main/assets
|
||||
LAUNCHER_URL=https://lab.c95.org/fr4nz/helium-helper/raw/branch/main/assets/launcher/helium.desktop.template
|
||||
ICON_URL=https://lab.c95.org/fr4nz/helium-helper/raw/branch/main/assets/icon/helium.png
|
||||
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
|
||||
wget -P $TMP $LAUNCHER_URL -q --show-progress
|
||||
wget -P $TMP $ICON_URL -q --show-progress
|
||||
sed -i "s|%APP_LOCATION%|$INSTALL_PATH/$APP_NAME.AppImage|" $TMP/helium.desktop.template
|
||||
sed -i "s|%ICON_LOCATION%|$CONFIG_PATH/icon/helium.png|" $TMP/helium.desktop.template
|
||||
sed -i "s|%APP_VERSION%|$LOCAL_VERSION|" $TMP/helium.desktop.template
|
||||
mkdir -p $LAUNCHER_PATH $BACKUP_PATH $CONFIG_PATH/icon
|
||||
cp $TMP/helium.desktop.template $LAUNCHER_PATH/$APP_NAME.desktop
|
||||
mv $TMP/helium.desktop.template $BACKUP_PATH/$APP_NAME.desktop.backup
|
||||
mv $TMP/helium.png $CONFIG_PATH/icon
|
||||
echo -e "\n ${GRN}$APP_NAME_LONG launcher is set up!${CRS}\n"
|
||||
exit
|
||||
exit_clean
|
||||
|
||||
elif [[ "$CONFIRM_LAUNCHER" == "n" || "$CONFIRM_LAUNCHER" == "N" ]] ; then
|
||||
echo -e "\n ${RED}Launcher creation cancelled!${CRS}\n"
|
||||
|
|
@ -140,10 +151,6 @@ add_launcher() {
|
|||
|
||||
done
|
||||
|
||||
elif [ -f "$LAUNCHER_PATH/$APP_NAME.desktop" ] ; then
|
||||
echo -e "\n ${RED}${APP_NAME}.desktop already exists!${CRS}"
|
||||
exit
|
||||
|
||||
else
|
||||
echo -e "\n ${RED}$APP_NAME_LONG AppImage not found! Can't add launcher...${CRS}"
|
||||
install_helium
|
||||
|
|
@ -182,6 +189,7 @@ update_helium() {
|
|||
|
||||
while true ; do
|
||||
read -p " Download and update $APP_NAME_LONG from $SOURCE? (Y/n) : " CONFIRM
|
||||
echo
|
||||
|
||||
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}')
|
||||
|
|
@ -241,6 +249,7 @@ remove_helium() {
|
|||
|
||||
if [[ "$CONFIRM_REMOVE" == "" || "$CONFIRM_REMOVE" == "y" || "$CONFIRM_REMOVE" == "Y" ]] ; then
|
||||
rm -rf $INSTALL_PATH
|
||||
rm $LAUNCHER_PATH/$APP_NAME.desktop
|
||||
echo -e "\n ${RED}$APP_NAME_LONG removed!${CRS}\n"
|
||||
exit
|
||||
|
||||
|
|
@ -284,7 +293,7 @@ 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/$APP_NAME.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
|
||||
|
|
@ -326,12 +335,12 @@ compare_version() {
|
|||
|
||||
### HELP
|
||||
help() {
|
||||
echo -e "\n${CYN}${SCRIPT_NAME}${CRS}\n"
|
||||
echo -e "\n${LCY}${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 "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-L\tCreate desktop launcher ${RED}--> Not yet working${CRS}"
|
||||
echo -e "\t-L\tCreate desktop launcher"
|
||||
echo -e "\t-u\tDownload & update $APP_NAME_LONG from $SOURCE"
|
||||
echo -e "\t-U\tEnable automatic updates on login ${RED}--> Not yet working${CRS}"
|
||||
echo -e "\t-r\tRemove $APP_NAME_LONG"
|
||||
|
|
@ -340,9 +349,9 @@ help() {
|
|||
echo -e "\t-S\tUpdate script ${RED}--> Not yet working${CRS}"
|
||||
echo -e "\t-h\tPrint this help page.\n"
|
||||
echo -e "Configured locations:\n"
|
||||
echo -e "\t${YEL}${INSTALL_PATH}${CRS}\t\tInstall location"
|
||||
echo -e "\t${YEL}${LAUNCHER_PATH}${CRS}\tLauncher location"
|
||||
echo -e "\t${YEL}${SCRIPT_PATH}${CRS}\t\t\tScript location\n"
|
||||
echo -e "\t${CYN}${INSTALL_PATH}${CRS}\t\tInstall location"
|
||||
echo -e "\t${CYN}${LAUNCHER_PATH}${CRS}\tLauncher location"
|
||||
echo -e "\t${CYN}${SCRIPT_PATH}${CRS}\t\t\tScript location\n"
|
||||
}
|
||||
|
||||
### EXIT CLEAN
|
||||
|
|
@ -422,7 +431,7 @@ while getopts ":i,:L,:u,:U,:r,:c,:s,:S,:h" OPTION ; do
|
|||
exit;;
|
||||
|
||||
*)
|
||||
echo -e "\n ${YEL}Option ${RED}-t${YEL} not recognized... Refer to help below!${CRS}"
|
||||
echo -e "\n${YEL}Option ${RED}-t${YEL} not recognized... Refer to help below!${CRS}"
|
||||
help
|
||||
exit;;
|
||||
|
||||
|
|
|
|||
38
test.sh
38
test.sh
|
|
@ -1,36 +1,12 @@
|
|||
#!/bin/bash
|
||||
TMP=/tmp/Helium
|
||||
DEPENDENCIES=("curl" "wget" "xeggw")
|
||||
### DEPENDENCIES --> NEEDS FIXING
|
||||
dependency_check () (
|
||||
mkdir -p $TMP
|
||||
cmd_query() {
|
||||
local PACKAGE="$1"
|
||||
|
||||
if command -v "$PACKAGE" >/dev/null 2>&1 ; then
|
||||
:
|
||||
|
||||
else
|
||||
echo "$PACKAGE" >> $TMP/missingDeps
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
for PACKAGE in "${DEPENDENCIES[@]}" ; do
|
||||
cmd_query "$PACKAGE"
|
||||
|
||||
done
|
||||
|
||||
if ! [ -f "$TMP/missingDeps" ] ; then
|
||||
:
|
||||
|
||||
add_launcher() {
|
||||
if [ -f "$INSTALL_PATH/helium-browser.AppImage" ] ; then
|
||||
|
||||
|
||||
else
|
||||
MISSING=$(cat $TMP/missingDeps)
|
||||
echo -e "\n ${RED}Following dependencies are missing :\n\n${YEL}$MISSING\n\n ${CYN}Please install and re-run script !${CRS}"
|
||||
echo -e "\n ${RED}Helium AppImage not found! Can't add launcher...${CRS}"
|
||||
exit
|
||||
|
||||
fi
|
||||
)
|
||||
|
||||
dependency_check
|
||||
rm -rf $TMP
|
||||
exit
|
||||
}
|
||||
9
todo.md
9
todo.md
|
|
@ -2,19 +2,18 @@
|
|||
|
||||
## Last Jobs
|
||||
- Improved Version comparasing
|
||||
- Added options [ -i | -u | -c | -s | -h ]
|
||||
- Pre - Released Version 0.5
|
||||
- Clean up function added
|
||||
- Remover function added --> Need to extend after launcher implementation
|
||||
- Remover function added
|
||||
- Dummy functions added for:
|
||||
- Desktop entry
|
||||
- Auto Update
|
||||
- Script update
|
||||
- Dependency check fixed
|
||||
- Launcher function works
|
||||
- Remover extended
|
||||
|
||||
|
||||
## Add
|
||||
- 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue