## Going Backwards

Yesterday I wrote about how I made a mistake by updating my primary Ubuntu computer to include the proposed pocket. I shouldn’t have done this. So today I quickly hacked together a script to take any packages which came from proposed and “downgrade” them back to the release pocket. It’s not pretty, but it worked, for me. #!/bin/bash TMPDIR=$(mktemp -d) PACKAGES=$TMPDIR/packages DOWNGRADE=$TMPDIR/downgrade # Get list of all installed packages dpkg -l | grep ^ii | awk -F ' ' '{ print$2}' > $PACKAGES # Start the downgrade script echo "sudo apt install \\" >$DOWNGRADE # For each package in the list of installed packages while read p; do # Get the summary of where the package came from apt-cache policy $p >$TMPDIR/$p # Get the line after (grep -A 1 and tail -n 1) the highlighted one with 3 stars SOURCE=$(grep -A 1 "^\ *\*\*" $TMPDIR/$p | tail -n 1 | awk -F ' ' '{ print $3}' ) # If that line suggests we got the package from proposed, add it to the script if [[ "$SOURCE" == *"hirsute-proposed"* ]]; then echo "$p/hirsute \\" >>$DOWNGRADE fi done <$PACKAGES # Tell the user what to run to actually do the downgrade echo "Run sh$DOWNGRADE" Don’t use this. [Read More]