diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-02-13 23:40:30 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-02-13 23:40:30 -0500 |
commit | ec0218e86b32dd80d8cb4e5a69ea7d7c9b5f4ad6 (patch) | |
tree | 0d62e0ba272f656b8f36e6c5ad4e789a08c8ade1 /init.d/50vcs-ignore | |
parent | 62bd8959418ca26c8b8e45561f4dba71758b0ec3 (diff) |
ignore file update support
* etckeeper update-ignore will automatically update the VCS ignore
file, only touching the part inside a "managed by etckeeper"
comment block.
* Run etckeeper update-ignore on upgrade.
Diffstat (limited to 'init.d/50vcs-ignore')
-rwxr-xr-x | init.d/50vcs-ignore | 102 |
1 files changed, 1 insertions, 101 deletions
diff --git a/init.d/50vcs-ignore b/init.d/50vcs-ignore index 3049b95..bcc88ba 100755 --- a/init.d/50vcs-ignore +++ b/init.d/50vcs-ignore @@ -1,104 +1,4 @@ #!/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 -elif [ "$VCS" = darcs ] && [ ! -e .darcsignore ]; then - file=.darcsignore -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 - ;; - darcs) - # darcs doesn't understand globs, so we need to translate - # them into regexs. Not a complete converter, but suitable - # for given globs. - if [ "${glob%\*}" != "$glob" ]; then - glob="${glob%\*}" - else - glob="$glob"'($|/)' - fi - if [ "${glob#\*}" != "$glob" ]; then - glob="${glob#\*}" - else - glob='(^|/)'"$glob" - fi - glob="$( printf %s $glob | sed -e 's/\./\\./g;s/\*/[^\/]*/g;s/\?/[^\/]/g' )" - echo "$glob" >> $file - esac -} - -if [ "$VCS" = darcs ]; then - darcs setpref boringfile .darcsignore -fi - -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 - -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 - -comment "editor temp files" -ignore "*~" -ignore ".*.sw?" -ignore "#*#" -ignore DEADJOE -nl +etckeeper update-ignore || true |