2023-12-03 02:09:46 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
restoreDir="/etc/restore"
|
|
|
|
|
2023-12-03 06:44:35 -05:00
|
|
|
hook_before() {
|
2023-12-03 02:09:46 -05:00
|
|
|
mkdir -p "$restoreDir" || exit 1
|
|
|
|
pushd "$restoreDir" || exit 2
|
|
|
|
|
|
|
|
rpm -qa | sort > Package.versions.list
|
|
|
|
rpm -qa --queryformat '%{NAME}.%{ARCH}\n' | sort > Package.list
|
|
|
|
|
|
|
|
cat > restore.sh <<EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [[ ! -f "Package.list" ]]; then
|
|
|
|
echo "This needs to be run inside the restore directory."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnf install \$(cat Package.list)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
popd || exit 2
|
|
|
|
}
|
|
|
|
|
2023-12-03 06:44:35 -05:00
|
|
|
hook_after() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
hook_fail() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
hook_final() {
|
2023-12-03 02:09:46 -05:00
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
2023-12-03 06:44:35 -05:00
|
|
|
before) hook_before || exit $?;;
|
|
|
|
after) hook_after || exit $?;;
|
|
|
|
fail) hook_fail || exit $?;;
|
|
|
|
finally) hook_final || exit $?;;
|
2023-12-03 02:09:46 -05:00
|
|
|
esac
|