]> pd.if.org Git - zpackage/blob - zpm-confgit
let newpackage set additional fields
[zpackage] / zpm-confgit
1 #!/bin/sh
2
3 # add all installed config files to git
4
5 # GIT_DIR=/var/lib/zpm/confgit
6
7
8 if [ -z "$TARGET" ]; then
9         TARGET=/var/lib/zpm/confgit
10         export TARGET
11 fi
12
13 if [ ! -d "$TARGET" ]; then
14         git init $TARGET
15 fi
16
17 efail=0
18 for pkgid in $(zpm list -I "$@"); do
19 zpm foreach-path -p $pkgid -F 'configuration = 1' | rsync --info=all0,backup1 --exclude=.git --files-from=- -drp / $TARGET
20 if [ $? -ne 0 ]; then
21         efail=1
22 fi
23 (
24 set -e
25 cd $TARGET
26 git add .
27 git diff --quiet && git diff --staged --quiet || git commit -m "update $pkgid configuration files"
28 )
29 if [ $? -ne 0 ]; then
30         efail=1
31 fi
32 done
33
34 exit $efail