Finalize backup list. Fixes for debian-upgrade.

This commit is contained in:
2025-08-22 14:04:21 -07:00
parent 86e3f40d36
commit 16466fb0c8

View File

@@ -755,8 +755,7 @@
BACKUP="$BACKUP_DIR/$BACKUP_FILENAME"
echo "*** Creating backup at '$BACKUP' ***"
sudo zip -rv "$BACKUP" \
/etc/apt /var/{log,mail} \
/etc/crontab /etc/cron.d /var/spool/cron \
/etc /var/{log,mail,spool} /srv /boot \
/usr/local/etc $EXTRA
status="$?"
if [[ "$status" != 0 ]]; then
@@ -778,16 +777,16 @@
if [[ -z "$OLD" || -z "$NEW" ]]; then
echo -n "ERROR: Please pass the OLD and NEW version names"
echo ", such as 'debian-upgrade bookworm trixie'. "
return 1
fi
echo "*** Doing an 'update' and 'backup' before starting upgrade. ***"
update
echo "*** Running 'backup' before starting upgrade. ***"
sleep 1
backup
echo "*** Listing the current apt listing for '$OLD' ***"
sudo grep "$OLD" /apt/sources.list /apt/sources.list.d/*
sudo grep "$OLD" /etc/apt/sources.list /etc/apt/sources.list.d/*
echo -en "\nAre these the entries you'd like changed to '$NEW'? (y/N) "
typeset -u confirm_change
@@ -795,16 +794,17 @@
if [[ -z "$confirm_change" || "$confirm_change" == "N"* ]]; then
echo "*** Aborting upgrade, change rejected. ***"
return 1
fi
unset confirm_change
echo "*** Continuing with upgrade. ***"
sudo sed -i 's/$OLD/$NEW/g' /etc/apt/sources.list
sudo sed -i "s/$OLD/$NEW/g" /etc/apt/sources.list
find /etc/apt/sources.list.d -name "*.list" \
-exec sudo sed -i 's/$OLD/$NEW/g' {} \;
-exec sudo sed -i "s/$OLD/$NEW/g" {} \;
sudo grep $OLD /apt/sources.list /apt/sources.list.d/*
sudo grep $NEW /apt/sources.list /apt/sources.list.d/*
sudo grep $OLD /etc/apt/sources.list /etc/apt/sources.list.d/*
sudo grep $NEW /etc/apt/sources.list /etc/apt/sources.list.d/*
echo -en "\nDo the source files look correct? (y/N) "
typeset -u confirm_correct
@@ -812,22 +812,25 @@
if [[ -z "$confirm_correct" || "$confirm_correct" == "N"* ]]; then
echo "*** Aborting upgrade, confirmation rejected. ***"
return 1
fi
unset confirm_correct
echo "*** Starting the upgrade. ***"
sleep 3
sleep 1
#sudo apt update
#sudo apt upgrade --without-new-pkgs
#sudo apt full-upgrade
sudo apt update
sudo apt upgrade --without-new-pkgs
sudo apt full-upgrade
echo "*** Upgrade complete, cleaning apt files. ***"
sleep 1
#sudo apt autoremove --purge
#sudo apt clean
sudo apt autoremove --purge
sudo apt clean
echo "*** All done! '$OLD' is now '$NEW'. Please reboot. ***"
sleep 1
unset OLD NEW
}
alias upgrade-debian="debian-upgrade"