diff options
Diffstat (limited to 'savelocaltweaks')
-rwxr-xr-x | savelocaltweaks | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/savelocaltweaks b/savelocaltweaks index 41caaef..7471765 100755 --- a/savelocaltweaks +++ b/savelocaltweaks @@ -1,18 +1,33 @@ #!/bin/sh +set -e + targetdir=/tmp/localtweaks origfiles="`cd /etc && find . -name '*.orig'`" oldfiles="`cd /etc && find . -name '*.old'`" +includes="" +excludes="" +if [ -d /etc/local ]; then + if [ -r /etc/local/localtweaks.include ]; then + includes="`cat /etc/local/localtweaks.include`" + fi + if [ -r /etc/local/localtweaks.exclude ]; then + excludes="`cat /etc/local/localtweaks.exclude`" + fi +fi -# merge all to only process once when both .orig and .old exist -files="`echo $origfiles $oldfiles | tsort`" +files="$origfiles $oldfiles $includes" -for file in $files; do +# process all *.{orig,old} once each +for file in `for x in $files; do echo $x; done | uniq | sort`; do olddir="/etc/`dirname $file`" newdir="$targetdir/`dirname $file`" oldname="`basename $file`" newname="`basename $file .orig`" + for exclude in $excludes; do + [ "$newname" = "$exclude" ] && continue 2 + done if [ ! -e $olddir/$newname.orig ]; then newname="`basename $file .old`" fi |