From b588b1ca787964394f8739f8ecdb114268daca6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Fuhry?= Date: Wed, 24 May 2023 11:50:10 +0200 Subject: [PATCH] new backup flag --- update | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/update b/update index 5ffa90a..8696d2d 100644 --- a/update +++ b/update @@ -4,9 +4,9 @@ source "$HOME"/.config/update.conf -VER="2.0.6" +VER="2.0.7" IGREEN="\033[0;92m" # Intense Green -IYELLOW="\033[0;93m" # Intense Red +IYELLOW="\033[0;93m" # Intense Yellow NC="\033[0m" # Text Reset TMP="/tmp/update" DATE="$(date +"%Y-%m-%d %H:%M:%S")" @@ -60,6 +60,7 @@ before_backup() { rm -r "$TMP" > /dev/null 2>&1 mkdir "$TMP" && mkdir "$TMP"/before-backup_"$DATE" && mkdir "$TMP"/after-backup_"$DATE" pacman -Qq > "$TMP"/before-backup_"$DATE"/pacman-pre.txt + [[ -f "$TMP"/before-backup_"$DATE"/pacman-pre.txt ]] || echo -e "$IYELLOW backup was unsuccessful" || exit 1 [[ -f /usr/bin/flatpak ]] && flatpak list > "$TMP"/before-backup_"$DATE"/flatpak-pre.txt sudo touch /var/lib/pacman/db.lck tar -cJf "$TMP"/before-backup_"$DATE".tar.xz.new "$TMP"/before-backup_"$DATE" /var/lib/pacman/local > /dev/null 2>&1 @@ -93,6 +94,8 @@ if [[ ${1:0:2} = -- ]]; then sudo pacman -Sy > /dev/null 2>&1 && sudo pacman -Qu ;; version) echo "$VER" ;; + backup) + before_backup ;; ?) Help && exit 1;; esac