Backup process refined

This commit is contained in:
Fr4nz D13trich 2026-01-10 12:58:37 +01:00
parent 1a253d6de5
commit 88510e971a
2 changed files with 257 additions and 149 deletions

View file

@ -66,7 +66,7 @@ dependency_check () {
if [ -f "$TMP/missingDeps" ] ; then
MISSING=$(cat $TMP/missingDeps)
echo "$DATE | Failed to update - missing dependencies : $MISSING" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
exit_clean
fi
@ -74,12 +74,12 @@ dependency_check () {
if ! [ -d "$INSTALL_PATH" ] ; then
mkdir -p $INSTALL_PATH
echo "$DATE | Failed to update - $APP_NAME installation path not present - But created for logging" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
exit
elif ! [ -f "$INSTALL_PATH/$APP_NAME.$FILE_EXTENSION" ] ; then
echo "$DATE | Failed to update - Local $APP_NAME AppImage not found" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Update failed! See log for details"
exit
fi
@ -160,7 +160,7 @@ backup_helium() {
fi
echo "$DATE | Backup - Backup (compressed $BACKUP_COMPRESSION archive) written to $BACKUP_PATH" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Backup created"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Backup created"
cd $CWD
fi
@ -174,7 +174,7 @@ update_script() {
### CHECK FOR LOCAL SCRIPT
if ! [ -f "$SCRIPT_PATH/$SCRIPT_FILE_NAME" ] ; then
echo "$DATE | Failed to update script - local file not found" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Script update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
exit
fi
@ -184,12 +184,12 @@ update_script() {
### CHECK FOR EMPTY VERSION TAGS
if [ -z "$SCRIPT_VERSION" ] ; then
echo "$DATE | Failed to update script - Empty version tag --> local" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Script update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
exit
elif [ -z "$REMOTE_SCRIPT_VERSION" ] ; then
echo "$DATE | Failed to update script - Empty version tag --> $APP_SOURCE" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Script update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
exit
fi
@ -199,7 +199,7 @@ update_script() {
REMOTE_SCRIPT_VERSION_NUM=$(echo $REMOTE_SCRIPT_VERSION | tr -d .)
if [ "$REMOTE_SCRIPT_VERSION" == "$SCRIPT_VERSION" ] ; then
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "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
mv $SCRIPT_PATH/$SCRIPT_FILE_NAME $BACKUP_PATH/$SCRIPT_FILE_NAME.old
@ -209,13 +209,13 @@ update_script() {
chmod +x $TMP/$SCRIPT_FILE_NAME $TMP/$PARENT_SCRIPT_FILE_NAME
mv $TMP/$SCRIPT_FILE_NAME $TMP/$PARENT_SCRIPT_FILE_NAME $SCRIPT_PATH
echo "$DATE | Script updated to version $REMOTE_SCRIPT_VERSION" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Script updated to version $REMOTE_SCRIPT_VERSION"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script updated to version $REMOTE_SCRIPT_VERSION"
else
echo "$DATE | Failed to update - Malformed version tags" >> $LOG
echo "$DATE | Remote Version: $REMOTE_SCRIPT_VERSION" >> $LOG
echo "$DATE | Local Version: $SCRIPT_VERSION" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Script update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Script update failed! See log for details"
fi
}
@ -229,12 +229,12 @@ update_helium() {
### CHECK FOR EMPTY VERSION TAGS
if [[ -z "$APP_SOURCE_VERSION" ]] ; then
echo "$DATE | Failed to update - Empty version tag --> $APP_SOURCE" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Browser update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit
elif [[ -z "$LOCAL_VERSION" ]] ; then
echo "$DATE | Failed to update - Empty version tag --> LOCAL" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Browser update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit
fi
@ -244,7 +244,7 @@ update_helium() {
APP_SOURCE_VERSION_NUM=$(echo $APP_SOURCE_VERSION | tr -d .)
if [ "$APP_SOURCE_VERSION" == "$LOCAL_VERSION" ] ; then
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Browser is up-to-date"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser is up-to-date"
elif [ "$APP_SOURCE_VERSION_NUM" -gt "$LOCAL_VERSION_NUM" ] ; then
mkdir -p $TMP
@ -254,11 +254,11 @@ update_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 "$DATE | $APP_NAME updated to version ${APP_SOURCE_VERSION}" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Browser updated to version $APP_SOURCE_VERSION"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser updated to version $APP_SOURCE_VERSION"
else
echo "$DATE | Failed to update - Version tags malformed" >> $LOG
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "Browser update failed! See log for details"
notify-send --icon="$ICON" "$NOTIFY_NAME" "Browser update failed! See log for details"
exit
fi
@ -277,7 +277,7 @@ show_log() {
xdg-open $LOG
else
notify-send --icon="$ICON" --app-name="$NOTIFY_NAME" "No log created yet"
notify-send --icon="$ICON" "$NOTIFY_NAME" "No log created yet"
fi
}
@ -314,6 +314,13 @@ exit_clean() {
## 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)