Last active
November 13, 2023 15:05
-
-
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.
This file contains hidden or 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/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