diff --git a/scripts/os b/scripts/os index f015e7c..c3ba1b9 100755 --- a/scripts/os +++ b/scripts/os @@ -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 } diff --git a/scripts/os_debian b/scripts/os_debian index d194f71..7908436 100755 --- a/scripts/os_debian +++ b/scripts/os_debian @@ -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" + : } diff --git a/scripts/os_fedora b/scripts/os_fedora index c4f1cea..8706b6a 100755 --- a/scripts/os_fedora +++ b/scripts/os_fedora @@ -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 diff --git a/scripts/os_garuda b/scripts/os_garuda new file mode 100644 index 0000000..30d3f5c --- /dev/null +++ b/scripts/os_garuda @@ -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 <