summaryrefslogtreecommitdiff
path: root/bin/unskel
blob: 80f77d5372c33643c1ab7abcdf9c85e6cbf7bde7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

# Removes contents of /etc/skel in home directory.  Checks for
# modifications, so should always be safe to run.

SKEL="/etc/skel"
torm=""

for skelfile in $(find $SKEL -maxdepth 1 -type f | sed -e "s|${SKEL}/||"); do
    # The following conditional passes if the file in $HOME is the
    # *same* as the file in $SKEL, so it ought to be deleted.
    if diff -q "$SKEL/$skelfile" "$HOME/$skelfile" >/dev/null 2>&1; then
       torm="$torm $HOME/$skelfile"
    fi
done

[ "$torm" = "" ] || rm -rf $torm

# on Debian systems root gets a special .bashrc and .profile
if diff -q /usr/share/base-files/dot.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
    rm -f "$HOME/.bashrc"
fi
if diff -q /usr/share/base-files/dot.profile "$HOME/.profile" >/dev/null 2>&1; then
    rm -f "$HOME/.profile"
fi