From a9f4626aa937c30ae66d5b3e57e65427510069bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Fuhry?= Date: Mon, 19 Dec 2022 14:28:18 +0100 Subject: [PATCH] many small fixes --- update | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/update b/update index bac9cde..472f0ca 100644 --- a/update +++ b/update @@ -2,14 +2,14 @@ # shellcheck source=/dev/null # updates via an aur-helper and flatpak with flags -# version 0.5 +# version 0.6 # add options to change aur-helper in the config # maybe make a first time setup, which asks for backup_location and aur_helper, maybe even if you wanna opt-in to non-interactive flatpak-update (maybe a flag?) -IGreen="\033[0;92m" # Green -NC="\033[0m" # Text Reset +IGreen="\033[0;92m" # Green +NC="\033[0m" # Text Reset source ~/.config/update.conf @@ -20,16 +20,16 @@ Help() { echo "Usage: update [OPTION]" echo echo "options:" - echo "no flag same as -a" - echo "f updates using flatpak update only" - echo "y updates using an aur-helper only" - echo "a updates using flatpak update and an aur-helper" - echo "g shutdowns the computer afterwards (needs to be the last or only option to work properly)" - echo "r reboots the computer afterwards (needs to be the last or only option to work properly)" + echo "no flag same as -a" + echo "-f updates using flatpak update only" + echo "-y updates using an aur-helper only" + echo "-a updates using flatpak update and an aur-helper" + echo "-g shutdowns the computer afterwards (needs to be the last or only option to work properly)" + echo "-r reboots the computer afterwards (needs to be the last or only option to work properly)" } # creates package lists, moves them into a zip, adds some other files to the zip and backups the pacman database in the form of a tar -# it then rsyncs the zip and the tar to the backup location which is specified in the config +# it then rsyncs the zip and the tar to the backup location before_backup() { paclog-pkglist > ~/pacman-pre.txt flatpak list > ~/flatpak-pre.txt @@ -39,13 +39,12 @@ before_backup() { rsync --remove-source-files ~/before_backup.zip ~/pacman_database.tar.xz "$backup_location" } -# moves the package lists into a zip, it then rsyncs the zip to the backup location which is specified in the config +# moves the package lists into a zip, it then rsyncs the zip to the backup location after_backup() { zip --quiet --move ~/after_backup.zip ~/pacman-after.txt ~/flatpak-after.txt rsync --remove-source-files ~/after_backup.zip "$backup_location" } -# aur-helper needs to be added to the config, which should be in /home/*/.config/update/update.conf # updates using aur-helper update_with_aur_helper() { "$aur_helper" @@ -58,9 +57,9 @@ update_with_flatpak() { flatpak list > ~/flatpak-after.txt } -[[ $should_backup ]] && before_backup && echo -e "${IGreen} pre-backup complete ${NC}" +before_backup && echo -e "${IGreen} pre-backup complete ${NC}" -[[ -z $1 ]] && update_with_aur_helper && update_with_flatpak; +[[ $1 ]] || update_with_aur_helper && update_with_flatpak; while getopts 'fyagr' OPTION; do case "$OPTION" in f) @@ -81,4 +80,4 @@ while getopts 'fyagr' OPTION; do esac done -[[ $should_backup ]] && after_backup && echo -e "${IGreen} after-backup complete ${NC}" \ No newline at end of file +after_backup && echo -e "${IGreen} after-backup complete ${NC}" \ No newline at end of file