summaryrefslogtreecommitdiff
path: root/init.d/50vcs-ignore
blob: 43c245d3be9df59f23b1e342c816f9bb5153fdcb (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
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
#!/bin/sh
set -e

if [ "$VCS" = git ] && [ ! -e .gitignore ]; then
	file=.gitignore
elif [ "$VCS" = hg ] && [ ! -e .hgignore ]; then
	file=.hgignore
elif [ "$VCS" = bzr ] && [ ! -e .bzrignore ]; then
	file=.bzrignore
fi

if [ -z "$file" ] || [ -e "$file" ]; then
	exit 0
fi

nl() {
	echo >>$file
}

comment() {
	comment="$1"
	echo "# $comment" >>$file
}

ignore() {
	glob="$1"
	
	case "$VCS" in
		git|bzr)
			echo "$glob" >> $file
		;;
		hg)
			# rather than converting the glob to a regexp, just
			# configure hg to use globs
			if [ -z "$hg_syntax_printed" ]; then
				comment "use glob syntax"
				echo "syntax: glob" >> $file
				nl
				hg_syntax_printed=1
			fi
			echo "$glob" >> $file
		;;
	esac
}

if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then
	comment "new and old versions of conffiles, stored by dpkg"
	ignore "*.dpkg-*"
	nl
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "rpm" ]; then
	comment "new and old versions of conffiles, stored by apt/rpm"
	ignore "*.rpm*"
	nl
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "pacman-g2" ]; then
	comment "new and old versions of conffiles, stored by pacman"
	ignore "*.pacnew"
	ignore "*.pacorig"
	ignore "*.pacsave"
	nl
fi

ignore "*~"
nl

comment "mount(8) records system state here, no need to store these"
ignore blkid.tab
ignore blkid.tab.old
nl

comment "some other files in /etc that typically do not need to be tracked"
ignore nologin
ignore ld.so.cache
ignore mtab
ignore .pwd.lock
ignore network/run
ignore adjtime
ignore lvm/cache
nl