From 8b5704f39758236f4e435fa73c96c51622a106e0 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Sat, 13 Jul 2024 00:11:03 +0200 Subject: [PATCH] remove most options --- update | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/update b/update index f2bdde9..fab62c2 100755 --- a/update +++ b/update @@ -1,12 +1,11 @@ #!/usr/bin/bash -VERSION="2.1.1" +VERSION="3.0.0" IGREEN="\033[0;92m" # Intense Green IYELLOW="\033[0;93m" # Intense Yellow NO_COLOR="\033[0m" # Text Reset TMP="/tmp/update" DATE="$(date +"%Y-%m-%dT%H:%M:%S%:z")" # RFC 3339 date-time https://datatracker.ietf.org/doc/html/rfc3339#section-5.6 -FINAL_COMMAND="true" source "$HOME"/.config/update.conf || exit 1 @@ -44,18 +43,10 @@ interrupt_function() { help() { echo "Usage: update [OPTION]" - echo echo "options:" - echo "no option same as -p" - echo "-f updates using flatpak update only" - echo "-p updates using a pacman-wrapper only" - echo "-a updates using flatpak update and a pacman-wrapper" - echo "-g shutdowns the computer afterwards" - echo "-r reboots the computer afterwards" echo "--help displays this message" echo "--preview shows a preview of pkg's and flatpaks which can be updated" echo "--version prints out the version number" - echo "--backup just does the before-backup without updating" } lock_pacman_db() { @@ -124,12 +115,6 @@ if [[ ${1:0:2} == \-\- ]]; then [[ -x /usr/bin/flatpak ]] && flatpak remote-ls --updates ;; version) echo "$VERSION" ;; - backup) - before_backup - delete_oldest_backup before-backup - mv "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst - [[ $SECONDARY_BACKUP_LOCATION ]] && mv "$SECONDARY_BACKUP_LOCATION"/before-backup_"$DATE".tar.zst.new "$SECONDARY_BACKUP_LOCATION"/before-backup_"$DATE".tar.zst - rm --recursive --force "$TMP" ;; ?) help; exit 1;; esac @@ -137,29 +122,5 @@ if [[ ${1:0:2} == \-\- ]]; then fi before_backup && echo -e "${IGREEN}pre-backup complete${NO_COLOR}" - -[[ -z $1 ]] && update -while getopts 'fpagr' OPTIONS; do - case $OPTIONS in - f) - if [[ -x /usr/bin/flatpak ]]; then - flatpak update --assumeyes - flatpak list --all --show-details > "$TMP"/after-backup_"$DATE"/flatpak-after.txt - fi ;; - p) - "$PACMAN_WRAPPER" ;; - a) - update ;; - g) - [[ $1 == \-\g ]] && update - FINAL_COMMAND="systemctl --check-inhibitors=yes poweroff" ;; - r) - [[ $1 == \-\r ]] && update - FINAL_COMMAND="systemctl --check-inhibitors=yes reboot" ;; - ?) - help; exit 1;; - esac -done - +update after_backup && echo -e "${IGREEN}after-backup complete${NO_COLOR}" -$FINAL_COMMAND && exit 0