31 lines
925 B
Bash
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
|
||
|
}
|