Skip to content

Instantly share code, notes, and snippets.

@89luca89
Last active November 13, 2023 15:05
Show Gist options
  • Save 89luca89/63ec5f7afc804180b6de624c1ea808e1 to your computer and use it in GitHub Desktop.
Save 89luca89/63ec5f7afc804180b6de624c1ea808e1 to your computer and use it in GitHub Desktop.
This script will compare current /etc/ on a system with the "initial" one of a fresh install of the same system.
#!/bin/sh
set -o errexit
set -o nounset
if [ "$EUID" -ne 0 ]; then
sudo "$0" "$@"
exit
fi
FIRST_SNAPSHOT="$(ls -1 /.snapshots/ | head -1)"
diff -qr /etc/ /.snapshots/"$FIRST_SNAPSHOT"/snapshot/etc/ 2> /dev/null |
sort -h |
sed 's|Only in /etc|A /etc|g' |
sed "s|Only in /.snapshots/$FIRST_SNAPSHOT/snapshot|D |g" |
sed 's|Files |M |g' |
sed 's| and.*differ||g' |
sed 's|: |/|g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment