f06d9a07839b8116f3f8bcfb5e29caee735c4d41
2 # NOTE: file derived from etckeeper/update-ignore.d/01update-ignore
5 if [ "$VCS" = git
]; then
8 elif [ "$VCS" = hg
]; then
11 elif [ "$VCS" = bzr
]; then
14 elif [ "$VCS" = darcs
]; then
18 echo "etckeeper: unsupported VCS $VCS" >&2
22 if [ ! -d "$dir" ]; then
26 managed_by_etckeeper
="managed by update-ignore.d/02custom-ignore"
34 echo "# $comment" >>"$file"
42 # escape "#" in ignores, as otherwise it may
43 # be considered a comment
44 echo "$glob" |
sed 's/#/\\#/g' >>"$file"
47 echo "$glob" >>"$file"
50 # rather than converting the glob to a regexp, just
51 # configure hg to use globs
52 if [ -z "$hg_syntax_printed" ]; then
53 comment
"use glob syntax"
54 echo "syntax: glob" >>"$file"
58 echo "$glob" |
sed 's/#/\\#/g' >>"$file"
61 # darcs doesn't understand globs, so we need to
62 # translate them into regexs. Not a complete converter,
63 # but suitable for given globs.
64 if [ "${glob%\*}" != "$glob" ]; then
69 if [ "${glob#\*}" != "$glob" ]; then
74 glob
="$( printf %s $glob | sed -e 's/\./\\./g;s/\*/[^\/]*/g;s/\?/[^\/]/g' )"
75 echo "$glob" >>"$file"
80 comment
"begin section $managed_by_etckeeper (do not edit this section by hand)"
85 comment
"end section $managed_by_etckeeper"
88 if [ -e "$file" ]; then
89 if ! grep -q "$managed_by_etckeeper" "$file"; then
90 if [ "$1" != "-a" ]; then
91 echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not updating"
94 echo "etckeeper: "$file" exists but does not contain \"$managed_by_etckeeper\" comment; updating"
100 if [ -n "`type -p tempfile`" ]; then
102 elif [ -n "`type -p mktemp`" ]; then
105 echo "etckeeper warning: can't find tempfile or mktemp" >&2
111 if echo "$line" |
grep -q "$managed_by_etckeeper"; then
112 if [ ! "$skipping" ]; then
118 elif [ ! "$skipping" ]; then
119 echo "$line" >> "$file"
122 if [ "$skipping" ]; then
123 # reached end of file w/o ending block
128 mv -f "$file" "$realfile"