borgmatic-base/scripts/os_garuda

42 lines
791 B
Bash
Executable file

#!/bin/bash
restoreDir="/etc/restore"
hook_check() {
:
}
hook_pre() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
pacman -Qqe > "pkglist.txt"
comm -13 <(pacman -Qqdt | sort) <(pacman -Qqdtt | sort) > optdeplist.txt
pacman -Qqem > foreignpkglist.txt
cat > restore.sh <<EOF
#!/bin/bash
# Install non-foreign packages from pgklist:
pacman -S --needed \$(comm -12 <(pacman -Slq | sort) <(sort pkglist.txt))
# Remove packages not listed.
#pacman -Rsu \$(comm -23 <(pacman -Qq | sort) <(sort pkglist.txt))
# Install AUR packages
paru -Sa --fm thunar - <foreign-pkglist.txt
EOF
popd || exit 2
}
hook_post() {
:
}
case "$1" in
before_check) hook_check;;
before_backup) hook_pre;;
after_backup) hook_post;;
esac