3 # etcdiff (deb-etcdiff?) shows how your current /etc dir
4 # diverges from the debian distribution standard one.
6 # Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it>
7 # License: GPLv2 or later
13 DEBIANMIRROR="http://ftp.it.debian.org/debian"
15 rm $PROMPT_RM -r temp && mkdir temp
16 rm $PROMPT_RM -r archives && mkdir archives
17 rm $PROMPT_RM -r conf && mkdir -p conf/patches
20 MAXDEPTH="-maxdepth 1"
22 #FILES="/etc/sysctl.conf /etc/init.d/procps /etc/passwd-"
23 FILES=$(find /etc/ $MAXDEPTH -type f $USERMODE | grep -v '.dpkg-')
29 # Find out what installed package provides the config file
30 PACKAGE=$(dpkg-query -S "$file" | cut -d ':' -f 1 | uniq 2> /dev/null)
32 # Copy the whole file if it is not provided by default
33 if [ "x$PACKAGE" == "x" ];
39 # Get the package from the repository and diff
41 FILENAME=$(apt-cache show $PACKAGE | grep ^Filename | cut -d ' ' -f 2-)
42 ARCHIVE=$(basename $FILENAME)
44 (cd archives && wget -q -nc -c $DEBIANMIRROR/$FILENAME)
45 dpkg -x archives/$ARCHIVE temp/
47 diff -q temp/$file $file > /dev/null
50 diff -u temp/$file $file > conf/patches/$(basename $file).patch
52 echo "$file: not changed"