update/update.zsh
AustrianToast e2d4253050
re-add functionality
This file is needed to restore preview and flatpak update functionality
2024-09-08 22:48:27 +02:00

31 lines
925 B
Bash

preview() {
yay -Syy && yay -Qu
[[ -x /usr/bin/flatpak ]] && flatpak remote-ls --updates
}
flatpak-update() {
TMP="/tmp/update"
DATE="$(date +"%Y-%m-%dT%H:%M:%S%:z")"
BACKUP_LOCATION="/opt"
[[ -d $TMP ]] && rm --recursive --force "$TMP"
mkdir --parents "$TMP"/before-backup_"$DATE" "$TMP"/after-backup_"$DATE"
flatpak list --all --show-details > "$TMP"/before-backup_"$DATE"/flatpak-before.txt
tar --create --zstd --file "$TMP"/before-backup_"$DATE".tar.zst "$TMP"/before-backup_"$DATE"
flatpak update --assumeyes
flatpak list --all --show-details > "$TMP"/after-backup_"$DATE"/flatpak-after.txt
tar --create --zstd --file "$TMP"/after-backup_"$DATE".tar.zst "$TMP"/after-backup_"$DATE"
rsync -a "$TMP"/before-backup_"$DATE".tar.zst "$TMP"/after-backup_"$DATE".tar.zst "$BACKUP_LOCATION"
rm --recursive --force "$TMP"
}
update () {
yay
flatpak-update
}