]> Frank Brehm's Git Trees - config/bruni/etc.git/commitdiff
saving uncommitted changes in /etc prior to emerge run
authorfrank <frank@bruni.home.brehm-online.com>
Tue, 14 Aug 2012 10:29:19 +0000 (12:29 +0200)
committerFrank Brehm <root@bruni.home.brehm-online.com>
Tue, 14 Aug 2012 10:29:19 +0000 (12:29 +0200)
etckeeper/etckeeper.conf
etckeeper/init.d/50vcs-ignore
etckeeper/list-installed.d/50list-installed
etckeeper/pre-commit.d/30store-metadata
etckeeper/unclean.d/50test
etckeeper/uninit.d/01prompt
etckeeper/uninit.d/50vcs-uninit
etckeeper/update-ignore.d/01update-ignore

index d346d21d64d2079cf8a123a59c698d543b94c188..b910c8a050d260afbc6da98968b3756e69a76b67 100644 (file)
@@ -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
index bcc88ba9422fed605c9cdd571b6fce3163b0a826..33d79d3c0b971a714752c73ba5ee953834e8b0fe 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 set -e
 
-etckeeper update-ignore || true
+etckeeper update-ignore -a || true
index 9ead66a6b9e0b4e721173d46655d4c6754dacdb4..48278d1c7f3a182a69a9f52203fb6763f015c017 100755 (executable)
@@ -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
index ce0bc025e1bb71aed0556b00201cb3ff7e619775..455429af13e8fe77b03b1b9a199f2ae5ee44b240 100755 (executable)
@@ -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() {
index 84e6be7ca00bca5f6d1371e472a6f83ad23e4acb..e52003f752dd31540858b60e1f02a190964215de 100755 (executable)
@@ -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
index 07f2e41d2b9faeb76cd7b973bb9692110e359c3b..8b439375ab6265f7ac28d81cb01388e2a00cb87c 100755 (executable)
@@ -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
index eb9f13ac0d80f151938ed6c2195d08c8c2c48120..803b0b53c9e27b1eab4027ca9d0326827b5bbbd9 100755 (executable)
@@ -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
index e110611d99491a1d8c9a3094a88a25daaa15f2ec..46d8162792d0be48e2854951f256b65fbf815c77 100755 (executable)
@@ -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