From 9769d2a137eac8d8e4f9e5aef6fd49b3c9731e6c Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Sun, 17 Sep 2023 16:43:29 -0400 Subject: [PATCH] Added apt repos to backup/restore --- scripts/os_debian | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/os_debian b/scripts/os_debian index 7908436..53b21d6 100755 --- a/scripts/os_debian +++ b/scripts/os_debian @@ -2,9 +2,15 @@ restoreDir="/etc/restore" +function is_bin_in_path { + builtin type -P "$1" &>/dev/null +} hook_check() { - : + if ! is_bin_in_path aptitude; then + echo "aptitude needs to be installed for backups to work properly." + exit 1 + fi } hook_pre() { @@ -14,7 +20,9 @@ hook_pre() { dpkg --get-selections > Package.list aptitude search --disable-columns -F%p '~i!~M!~v' > InstallOnly.list #apt-key exportall > /etc/restore/Repo.keys - rsync -avhHi /etc/apt/trusted.gpg.d /etc/restore/ + cp -a /etc/apt/sources.list "$restoreDir/" + rsync -avhHi /etc/apt/sources.list.d "$restoreDir/" + rsync -avhHi /etc/apt/trusted.gpg.d "$restoreDir/" cat > restore.sh <