Compare commits

...

2 Commits

Author SHA1 Message Date
e86a004a28
add missing check for flatpak 2024-07-07 02:17:51 +02:00
a8eee49762
remove trailing slash 2024-07-07 01:53:09 +02:00
2 changed files with 5 additions and 4 deletions

5
update
View File

@ -79,7 +79,7 @@ before_backup() {
mkdir --parents "$TMP"/before-backup_"$DATE" "$TMP"/after-backup_"$DATE" mkdir --parents "$TMP"/before-backup_"$DATE" "$TMP"/after-backup_"$DATE"
pacman --verbose --query > "$TMP"/before-backup_"$DATE"/pacman-before.txt pacman --verbose --query > "$TMP"/before-backup_"$DATE"/pacman-before.txt
[[ -f /usr/bin/flatpak ]] && flatpak list --all --show-details > "$TMP"/before-backup_"$DATE"/flatpak-before.txt [[ -x /usr/bin/flatpak ]] && flatpak list --all --show-details > "$TMP"/before-backup_"$DATE"/flatpak-before.txt
tar --create --zstd --file "$TMP"/before-backup_"$DATE".tar.zst.new "$TMP"/before-backup_"$DATE" /var/lib/pacman/local > /dev/null 2>&1 # for some reason it needs the output suppresion tar --create --zstd --file "$TMP"/before-backup_"$DATE".tar.zst.new "$TMP"/before-backup_"$DATE" /var/lib/pacman/local > /dev/null 2>&1 # for some reason it needs the output suppresion
mv "$TMP"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION" mv "$TMP"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"
@ -90,7 +90,7 @@ before_backup() {
after_backup() { after_backup() {
pacman --verbose --query > "$TMP"/after-backup_"$DATE"/pacman-after.txt pacman --verbose --query > "$TMP"/after-backup_"$DATE"/pacman-after.txt
flatpak list --all --show-details > "$TMP"/after-backup_"$DATE"/flatpak-after.txt [[ -x /usr/bin/flatpak ]] && flatpak list --all --show-details > "$TMP"/after-backup_"$DATE"/flatpak-after.txt
tar --create --zstd --file "$TMP"/after-backup_"$DATE".tar.zst.new "$TMP"/after-backup_"$DATE" > /dev/null 2>&1 tar --create --zstd --file "$TMP"/after-backup_"$DATE".tar.zst.new "$TMP"/after-backup_"$DATE" > /dev/null 2>&1
mv "$TMP"/after-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION" mv "$TMP"/after-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"
@ -128,6 +128,7 @@ if [[ ${1:0:2} == \-\- ]]; then
before_backup before_backup
delete_oldest_backup before-backup delete_oldest_backup before-backup
mv "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst 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" ;; rm --recursive --force "$TMP" ;;
?) ?)
help; exit 1;; help; exit 1;;

View File

@ -1,8 +1,8 @@
# backup to this folder # backup to this folder
BACKUP_LOCATION=~/ BACKUP_LOCATION=~
# optional secondary backup loaction # optional secondary backup loaction
#SECONDARY_BACKUP_LOCATION=~/ #SECONDARY_BACKUP_LOCATION=~
# use this pacman-wrapper # use this pacman-wrapper
PACMAN_WRAPPER=yay PACMAN_WRAPPER=yay