Created
July 6, 2019 05:33
-
-
Save wastrachan/24d672895397f86f7092bb69d15dca99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# APT Installed | |
# Compare currently installed packages with archived package list | |
# | |
# (c) Winston Astrachan 2019 | |
ARCHIVE_FILE=/etc/apt/basepackages.txt | |
if [ ! -f "$ARCHIVE_FILE" ]; then | |
read -r -p "Base package list does not exist at $ARCHIVE_FILE. Create it now? [Y/n]" response | |
if [[ $response =~ ^(yes|y|Y| ) ]] || [[ -z $response ]]; then | |
dpkg -l | awk 'NR > 3 { print }' | awk '{ print $2 }' | sort > $ARCHIVE_FILE | |
else | |
echo "Aborting..." | |
exit 0 | |
fi | |
fi | |
dpkg -l | awk 'NR > 3 { print }' | awk '{ print $2 }' | sort | diff -y - $ARCHIVE_FILE | less |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment