-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-sys-ignore-gen
executable file
·82 lines (64 loc) · 1.43 KB
/
git-sys-ignore-gen
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
export LANG=C
export LC_ALL=C
get_files() {
cd /
md5sum -c /var/lib/ucf/hashfile | grep 'OK$' | sed -e 's/: *OK *$//'
for IP in ${IGNORE_PATTERN}
do
cat ${SCRIPTPATH}/${IP}*.ignore
md5sum -c ${SCRIPTPATH}/${IP}*.ignore-chk | grep 'OK$' | sed -e 's/: *OK *$//'
done
echo
echo "# from debsums"
debsums -e | grep 'OK$' | sed -e 's/ *OK *$//'
echo
echo "# symlinks"
find \
/etc/ssl \
/etc/fonts \
/etc/apache2/mods-enabled \
/etc/php/7.0/apache2/conf.d \
/etc/php/7.0/cli/conf.d \
/etc/php5/apache2/conf.d \
/etc/php5/cli/conf.d \
-type l
}
get_files_uniq() {
get_files 2>/dev/null | awk '!x[$0]++'
# awk '!x[$0]++' == uniq without sorting
}
type -p debsums >/dev/null 2>&1
if test "x$?" = "x1"
then
echo "Please install debsums" >&2
echo "apt-get intall debsums" >&2
exit 2
fi
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
IGNORE_PATTERN="ignore.d/
/etc/sysgit/local-config"
if test -f ${SCRIPTPATH}/config.sh
then
source ${SCRIPTPATH}/config.sh
fi
if test -f "/etc/sysgit/ignore-config"
then
config_ignore="$(cat "/etc/sysgit/ignore-config")"
IGNORE_PATTERN="${IGNORE_PATTERN}
${config_ignore}"
fi
if test "x$1" = "x--update"
then
get_files_uniq >/.git/info/exclude
else
get_files_uniq
echo
echo "Run"
echo " git sys-ignore --update"
echo "to update system-wide git exclude file."
echo "This script is automatically executed when running"
echo " git sys-status"
fi
exit 0