Add show of failed packages for review before install and after

This commit is contained in:
Eric Renfro 2024-07-07 16:09:24 -04:00
parent a69d966c2c
commit f1efcf6274
Signed by: psi-jack
SSH key fingerprint: SHA256:1TKB8Z257L8EHK8GWNxKgMhD8a+FAR+f+j3nnlcuNVM

View file

@ -107,6 +107,11 @@ if [[ "\$promptPkgs" =~ ^[Yy] ]]; then
apt-get --simulate install \$(cat "\${TMPDIR}/diff.list") |& awk '/^E: Unable to locate package / {print \$NF}' | sort > "\${TMPDIR}/diff.fail" apt-get --simulate install \$(cat "\${TMPDIR}/diff.list") |& awk '/^E: Unable to locate package / {print \$NF}' | sort > "\${TMPDIR}/diff.fail"
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 "Packages that were omitted because they could not be found:"
cat "\${TMPDIR}/diff.fail" | tr '\n' ' ' | fold -s
echo
read -p "Did everything above look okay and do you want to proceed? [Y/n] " -n 1 -sr promptPkgsDo read -p "Did everything above look okay and do you want to proceed? [Y/n] " -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
@ -118,7 +123,7 @@ else
fi fi
echo "Packages that failed to schedule for install:" echo "Packages that failed to schedule for install:"
cat "\${TMPDIR}/diff.fail" 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