From: frank Date: Tue, 14 Aug 2012 10:46:20 +0000 (+0200) Subject: saving uncommitted changes in /etc prior to emerge run X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=769bfb7dfefd4d18ff02b29badf6a6c82dc4b4cf;p=config%2Fuhu1%2Fetc.git saving uncommitted changes in /etc prior to emerge run --- diff --git a/etckeeper/etckeeper.conf b/etckeeper/etckeeper.conf index d346d21..b910c8a 100644 --- a/etckeeper/etckeeper.conf +++ b/etckeeper/etckeeper.conf @@ -32,11 +32,9 @@ DARCS_COMMIT_OPTIONS="-a" # The high-level package manager that's being used. # (apt, pacman-g2, yum etc) # For gentoo this is emerge -#HIGHLEVEL_PACKAGE_MANAGER=apt HIGHLEVEL_PACKAGE_MANAGER=emerge # The low-level package manager that's being used. # (dpkg, rpm, pacman-g2, etc) -# For gentoo this is equery -#LOWLEVEL_PACKAGE_MANAGER=dpkg -LOWLEVEL_PACKAGE_MANAGER=equery +# For gentoo this is qlist +LOWLEVEL_PACKAGE_MANAGER=qlist diff --git a/etckeeper/init.d/50vcs-ignore b/etckeeper/init.d/50vcs-ignore index bcc88ba..33d79d3 100755 --- a/etckeeper/init.d/50vcs-ignore +++ b/etckeeper/init.d/50vcs-ignore @@ -1,4 +1,4 @@ #!/bin/sh set -e -etckeeper update-ignore || true +etckeeper update-ignore -a || true diff --git a/etckeeper/list-installed.d/50list-installed b/etckeeper/list-installed.d/50list-installed index 9ead66a..48278d1 100755 --- a/etckeeper/list-installed.d/50list-installed +++ b/etckeeper/list-installed.d/50list-installed @@ -7,11 +7,6 @@ if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then egrep '(ok installed|ok config-files)' | cut -f2,3 elif [ "$LOWLEVEL_PACKAGE_MANAGER" = rpm ]; then rpm -qa --qf "%|epoch?{%{epoch}}:{0}|:%{name}-%{version}-%{release}.%{arch}\n" | sort -fi - -if [ "$LOWLEVEL_PACKAGE_MANAGER" = equery ]; then - equery list '*' | cut -f1 -fi -if [ "$LOWLEVEL_PACKAGE_MANAGER" = portage ]; then - cd /var/db/pkg && ls -d */* | grep -v '/-MERGING-' +elif [ "$LOWLEVEL_PACKAGE_MANAGER" = qlist ]; then + qlist -ICv fi diff --git a/etckeeper/pre-commit.d/30store-metadata b/etckeeper/pre-commit.d/30store-metadata index ce0bc02..455429a 100755 --- a/etckeeper/pre-commit.d/30store-metadata +++ b/etckeeper/pre-commit.d/30store-metadata @@ -32,7 +32,7 @@ filter_ignore() { shellquote() { # Single quotes text, escaping existing single quotes. - sed -e "s/'/'\"'\"'/" -e "s/^/'/" -e "s/$/'/" + sed -e "s/'/'\"'\"'/g" -e "s/^/'/" -e "s/$/'/" } generate_metadata() { diff --git a/etckeeper/unclean.d/50test b/etckeeper/unclean.d/50test index 84e6be7..e52003f 100755 --- a/etckeeper/unclean.d/50test +++ b/etckeeper/unclean.d/50test @@ -2,11 +2,11 @@ set -e if [ "$VCS" = git ]; then - [ -d .git ] && [ -n "`git ls-files --modified --deleted --others --exclude-standard`" ] + [ -d .git ] && [ -n "`git status --porcelain`" ] elif [ "$VCS" = hg ]; then [ -d .hg ] && ! hg status 2>&1 | wc -l | grep -q "^0$" elif [ "$VCS" = bzr ]; then - [ -d .bzr ] && ! bzr status 2>/dev/null | wc -l | grep -q "^0$" + [ -d .bzr ] && ! bzr version-info --custom --template="{clean}\n" | grep -q "^1$" elif [ "$VCS" = darcs ]; then [ -d _darcs ] && darcs whatsnew -l >/dev/null fi diff --git a/etckeeper/uninit.d/01prompt b/etckeeper/uninit.d/01prompt index 07f2e41..8b43937 100755 --- a/etckeeper/uninit.d/01prompt +++ b/etckeeper/uninit.d/01prompt @@ -3,7 +3,7 @@ set -e if [ "$1" != "-f" ]; then echo "** Warning: This will DESTROY all recorded history for $ETCKEEPER_DIR," - echo "** including the $VCS repository and ignore file." + echo "** including the $VCS repository." echo "" printf "Are you sure you want to do this? [yN] " read answer diff --git a/etckeeper/uninit.d/50vcs-uninit b/etckeeper/uninit.d/50vcs-uninit index eb9f13a..803b0b5 100755 --- a/etckeeper/uninit.d/50vcs-uninit +++ b/etckeeper/uninit.d/50vcs-uninit @@ -18,7 +18,37 @@ fi managed_by_etckeeper="managed by etckeeper" if ! grep -q "$managed_by_etckeeper" "$file"; then - echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not removing" + exit 0 else - rm -f $file + realfile="$file" + if [ -n "`type -p tempfile`" ]; then + tempfile="tempfile" + elif [ -n "`type -p mktemp`" ]; then + tempfile="mktemp" + else + echo "etckeeper warning: can't find tempfile or mktemp" >&2 + exit 1 + fi + file=$($tempfile) + otherentries= + skipping= + while read line; do + if echo "$line" | grep -q "$managed_by_etckeeper"; then + if [ ! "$skipping" ]; then + skipping=1 + else + skipping= + fi + elif [ ! "$skipping" ]; then + echo "$line" >> "$file" + otherentries=1 + fi + done <"$realfile" + + if [ "$otherentries" ]; then + mv -f "$file" "$realfile" + else + rm -f "$file" + rm -f "$realfile" + fi fi diff --git a/etckeeper/update-ignore.d/01update-ignore b/etckeeper/update-ignore.d/01update-ignore index e110611..46d8162 100755 --- a/etckeeper/update-ignore.d/01update-ignore +++ b/etckeeper/update-ignore.d/01update-ignore @@ -99,9 +99,9 @@ writefile () { ignore "*.pacorig" ignore "*.pacsave" nl - elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "equery" ]; then + elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "qlist" ]; then comment "new and old versions of conffiles, stored by emerge" - ignore "*.ebuild*" + ignore "*.cfg_*" nl fi @@ -147,6 +147,8 @@ writefile () { ignore "*.pyo" ignore "init.d/.depend.*" ignore "openvpn/openvpn-status.log" + ignore "cups/subscriptions.conf" + ignore "cups/subscriptions.conf.O" nl comment "editor temp files" @@ -162,8 +164,14 @@ writefile () { if [ -e "$file" ]; then if ! grep -q "$managed_by_etckeeper" "$file"; then - echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not updating" - exit 1 + if [ "$1" != "-a" ]; then + echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not updating" + exit 1 + else + echo "etckeeper: "$file" exists but does not contain \"$managed_by_etckeeper\" comment; updating" + writefile + exit 0 + fi fi realfile="$file" if [ -n "`type -p tempfile`" ]; then