Fix missing bold prompt and cleanup further
This commit is contained in:
parent
7f4c3572d7
commit
6545a487e6
1 changed files with 9 additions and 12 deletions
|
@ -7,11 +7,6 @@ function is_bin_in_path {
|
||||||
}
|
}
|
||||||
|
|
||||||
hook_before() {
|
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
|
if ! is_bin_in_path rsync; then
|
||||||
echo "rsync needs to be installed for backups to work properly."
|
echo "rsync needs to be installed for backups to work properly."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -20,10 +15,8 @@ hook_before() {
|
||||||
mkdir -p "$restoreDir" || exit 1
|
mkdir -p "$restoreDir" || exit 1
|
||||||
pushd "$restoreDir" || exit 2
|
pushd "$restoreDir" || exit 2
|
||||||
|
|
||||||
dpkg --get-selections > Package.list
|
dpkg --get-selections | sort > Package.list
|
||||||
#aptitude search --disable-columns -F%p '~i!~M!~v' > InstallOnly.list
|
|
||||||
apt-mark showmanual | sort > InstallOnly.list
|
apt-mark showmanual | sort > InstallOnly.list
|
||||||
#apt-key exportall > /etc/restore/Repo.keys
|
|
||||||
cp -a /etc/apt/sources.list "$restoreDir/"
|
cp -a /etc/apt/sources.list "$restoreDir/"
|
||||||
rsync -avhHi /etc/apt/sources.list.d "$restoreDir/"
|
rsync -avhHi /etc/apt/sources.list.d "$restoreDir/"
|
||||||
rsync -avhHi /etc/apt/trusted.gpg.d "$restoreDir/"
|
rsync -avhHi /etc/apt/trusted.gpg.d "$restoreDir/"
|
||||||
|
@ -103,7 +96,7 @@ echo "INSTALL PACKAGES"
|
||||||
echo "=============================="
|
echo "=============================="
|
||||||
echo "\${normal}"
|
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
|
if [[ "\$promptPkgs" =~ ^[Yy] ]]; then
|
||||||
echo "Yes"
|
echo "Yes"
|
||||||
comm --nocheck-order -23 InstallOnly.list <(apt-mark showmanual|sort) | grep -Ev 'linux-image|linux-headers' > "\${TMPDIR}/diff.list"
|
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
|
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
|
if [[ "\$promptPkgsDo" =~ ^[Yy] ]]; then
|
||||||
comm --nocheck-order -23 "\${TMPDIR}/diff.list" "\${TMPDIR}/diff.fail" | xargs apt-get install
|
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
|
else
|
||||||
echo -e "Cancelled\n"
|
echo -e "Cancelled\n"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "Cancelled\n"
|
echo -e "Cancelled\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\${bold}Packages that failed to schedule for install:\${normal}"
|
|
||||||
cat "\${TMPDIR}/diff.fail" | tr '\n' ' ' | fold -s
|
|
||||||
EOF
|
EOF
|
||||||
chmod ug+rx restore.sh
|
chmod ug+rx restore.sh
|
||||||
popd || exit 2
|
popd || exit 2
|
||||||
|
|
Loading…
Reference in a new issue