X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=bin%2Fzpm-confgit;fp=bin%2Fzpm-confgit;h=5d82d40d8c3a92ede72f49230147205f972f54c3;hp=0000000000000000000000000000000000000000;hb=0419c62f964b259df1c1816f5870ef62eb97ed7c;hpb=0c2216d1e0dc8565a6bf61c9572e47bb1ae1c1fb diff --git a/bin/zpm-confgit b/bin/zpm-confgit new file mode 100755 index 0000000..5d82d40 --- /dev/null +++ b/bin/zpm-confgit @@ -0,0 +1,34 @@ +#!/bin/sh + +# add all installed config files to git + +# GIT_DIR=/var/lib/zpm/confgit + + +if [ -z "$TARGET" ]; then + TARGET=/var/lib/zpm/confgit + export TARGET +fi + +if [ ! -d "$TARGET" ]; then + git init $TARGET +fi + +efail=0 +for pkgid in $(zpm list -I "$@"); do +zpm foreach-path -p $pkgid -F 'configuration = 1' | rsync --info=all0,backup1 --exclude=.git --files-from=- -drp / $TARGET +if [ $? -ne 0 ]; then + efail=1 +fi +( +set -e +cd $TARGET +git add . +git diff --quiet && git diff --staged --quiet || git commit -m "update $pkgid configuration files" +) +if [ $? -ne 0 ]; then + efail=1 +fi +done + +exit $efail