Updated hooks and restore directory solution, added os_garuda

This commit is contained in:
Eric Renfro 2022-09-05 17:18:48 -04:00
parent ea83ca18bf
commit 480d69d9d9
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF
7 changed files with 61 additions and 23 deletions

View file

@ -12,9 +12,11 @@ fi
createRestoreDir() {
if [[ -d "${restoreDir}" ]]; then
rm -rf "${restoreDir}" || exit 2
# Keeps the directory, due to newer borgmatic service restrictions.
rm -rf "${restoreDir}/*" || exit 2
else
mkdir -p "${restoreDir}" || exit 2
fi
mkdir -p "${restoreDir}" || exit 2
}
checkOS() {
@ -41,6 +43,7 @@ runOsHook() {
case "$ID" in
debian) "${scriptPath}/os_debian" "$hook";;
fedora) "${scriptPath}/os_fedora" "$hook";;
garuda) "${scriptPath}/os_garuda" "$hook";;
solus) "${scriptPath}/os_solus" "$hook";;
opensuse-leap) "${scriptPath}/os_suse" "$hook";;
opensuse-tumbleweed) "${scriptPath}/os_suse" "$hook";;
@ -64,7 +67,10 @@ hook_pre() {
}
hook_post() {
rm -rf "$restoreDir"
if [[ ! -f "${restoreDir}/.keep" ]]; then
rm -rf "$restoreDir"
fi
runOsHook after_backup
}

View file

@ -4,9 +4,7 @@ restoreDir="/etc/restore"
hook_check() {
if [[ -d "$restoreDir" ]]; then
rm -rf "$restoreDir" || exit 1
fi
:
}
hook_pre() {
@ -54,7 +52,7 @@ EOF
}
hook_post() {
rm -rf "$restoreDir"
:
}

View file

@ -4,9 +4,7 @@ restoreDir="/etc/restore"
hook_check() {
if [[ -d "$restoreDir" ]]; then
rm -rf "$restoreDir" || exit 1
fi
:
}
hook_pre() {
@ -31,7 +29,7 @@ EOF
}
hook_post() {
rm -rf "$restoreDir"
:
}
case "$1" in

42
scripts/os_garuda Normal file
View file

@ -0,0 +1,42 @@
#!/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

View file

@ -4,9 +4,7 @@ restoreDir="$HOME/.borgmatic/restore"
hook_check() {
if [[ -d "$restoreDir" ]]; then
rm -rf "$restoreDir" || exit 1
fi
:
}
hook_pre() {
@ -31,7 +29,7 @@ EOF
}
hook_post() {
rm -rf "$restoreDir"
:
}

View file

@ -4,9 +4,7 @@ restoreDir="/etc/restore"
hook_check() {
if [[ -d "$restoreDir" ]]; then
rm -rf "$restoreDir" || exit 1
fi
:
}
hook_pre() {
@ -19,7 +17,7 @@ hook_pre() {
}
hook_post() {
rm -rf "$restoreDir"
:
}
case "$1" in

View file

@ -4,9 +4,7 @@ restoreDir="/etc/restore"
hook_check() {
if [[ -d "$restoreDir" ]]; then
rm -rf "$restoreDir" || exit 1
fi
:
}
hook_pre() {
@ -31,7 +29,7 @@ EOF
}
hook_post() {
rm -rf "$restoreDir"
:
}
case "$1" in