From 6545a487e6815248a6a6cc960a3ca7fdba8dca6c Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Sun, 7 Jul 2024 16:21:42 -0400 Subject: [PATCH] Fix missing bold prompt and cleanup further --- scripts/os_debian | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/os_debian b/scripts/os_debian index 8f719f8..3dfe0f1 100755 --- a/scripts/os_debian +++ b/scripts/os_debian @@ -7,11 +7,6 @@ function is_bin_in_path { } hook_before() { - #if ! is_bin_in_path aptitude; then - # echo "aptitude needs to be installed for backups to work properly." - # exit 1 - #fi - if ! is_bin_in_path rsync; then echo "rsync needs to be installed for backups to work properly." exit 1 @@ -20,10 +15,8 @@ hook_before() { mkdir -p "$restoreDir" || exit 1 pushd "$restoreDir" || exit 2 - dpkg --get-selections > Package.list - #aptitude search --disable-columns -F%p '~i!~M!~v' > InstallOnly.list + dpkg --get-selections | sort > Package.list apt-mark showmanual | sort > InstallOnly.list - #apt-key exportall > /etc/restore/Repo.keys cp -a /etc/apt/sources.list "$restoreDir/" rsync -avhHi /etc/apt/sources.list.d "$restoreDir/" rsync -avhHi /etc/apt/trusted.gpg.d "$restoreDir/" @@ -103,7 +96,7 @@ echo "INSTALL PACKAGES" echo "==============================" echo "\${normal}" -read -p "About to install the system packages per the backup. Do you want to continue? [Y/n] " -n 1 -sr promptPkgs +read -p "\${bold}About to install the system packages per the backup. Do you want to continue? [Y/n]\${normal} " -n 1 -sr promptPkgs if [[ "\$promptPkgs" =~ ^[Yy] ]]; then echo "Yes" comm --nocheck-order -23 InstallOnly.list <(apt-mark showmanual|sort) | grep -Ev 'linux-image|linux-headers' > "\${TMPDIR}/diff.list" @@ -119,15 +112,19 @@ if [[ "\$promptPkgs" =~ ^[Yy] ]]; then read -p "\${bold}Did everything above look okay and do you want to proceed? [Y/n]\${normal} " -n 1 -sr promptPkgsDo if [[ "\$promptPkgsDo" =~ ^[Yy] ]]; then comm --nocheck-order -23 "\${TMPDIR}/diff.list" "\${TMPDIR}/diff.fail" | xargs apt-get install + + echo + echo + echo "\${bold}Packages that failed to schedule for install:\${normal}" + cat "\${TMPDIR}/diff.fail" | tr '\n' ' ' | fold -s + echo + echo else echo -e "Cancelled\n" fi else echo -e "Cancelled\n" fi - -echo "\${bold}Packages that failed to schedule for install:\${normal}" -cat "\${TMPDIR}/diff.fail" | tr '\n' ' ' | fold -s EOF chmod ug+rx restore.sh popd || exit 2