6 FILEPATH=$(apt-cache show $PACKAGE | grep ^Filename | cut -d ' ' -f 2-)
8 if [ "x$FILEPATH" = "x" ];
10 echo "Package '$PACKAGE' does not exist."
14 ARCHIVE=$(basename $FILEPATH)
16 wget -q -nc -c $DEBIANMIRROR/$FILEPATH -P $CACHEDIR && \
17 ([ -d $TEMPDIR/$PACKAGE ] || mkdir $TEMPDIR/$PACKAGE) && \
18 dpkg -x $CACHEDIR/$ARCHIVE $TEMPDIR/$PACKAGE
26 REPORT_NAME=$(basename $ETCBASEDIR)
28 # Report diff between debian conf and our local one
29 rm -f $REPORTDIR/$REPORT_NAME.diff
30 find $PREFIX/etc -type f | \
33 diff -ruN $ETCBASEDIR/${file#$PREFIX/} ${file#$PREFIX} >> $REPORTDIR/$REPORT_NAME.diff
36 # Report symlinks in /etc
37 rm -f $REPORTDIR/$REPORT_NAME.symlinks
38 find $PREFIX/etc -type l | \
41 stat -c '%N' $file >> $REPORTDIR/$REPORT_NAME.symlinks
47 PACKAGES=$(dpkg --get-selections | grep 'install$' | cut -f 1 -d ' ')
49 rm $PROMPT_RM -rf $TEMPDIR/__debian_etc && mkdir $TEMPDIR/__debian_etc
54 # Skip packages which don't put anything in /etc
55 if ! dpkg -L $p | grep -q '/etc/';
60 echo "Getting package $p..."
61 _get_unpack_package $p
63 # save the original etc dir for later processing
64 cp -ir $TEMPDIR/$PACKAGE/etc $TEMPDIR/__debian_etc
67 _do_etcdiff $TEMPDIR/__debian_etc
69 rm -rf $TEMPDIR/__debian_etc
76 if dpkg --status $PACKAGE | grep -q 'not-installed';
78 echo "Package '$PACKAGE' not installed"
82 # Skip packages which don't put anything in /etc
83 if ! dpkg -L $PACKAGE | grep -q '/etc/';
85 echo "$PACKAGE does not put any file in /etc"
89 _get_unpack_package $PACKAGE
91 _do_etcdiff $TEMPDIR/$PACKAGE $TEMPDIR/$PACKAGE
102 echo "ERROR, file $FILE does not exist."
108 echo "ERROR, file $FILE is not a regular file."
112 if [ $FILE = ${FILE#/etc/} ];
114 echo "ERROR, file path must begin with /etc/."
118 # Find out which installed package provides the config file
119 PACKAGE=$(dpkg-query -S "$FILE" | cut -d ':' -f 1 | uniq 2> /dev/null)
121 REPORT_NAME=$(basename $FILE)
123 if [ "x$PACKAGE" = "x" ];
125 diff -ruN /dev/null $FILE > $REPORTDIR/$REPORT_NAME.diff
127 _get_unpack_package $PACKAGE
128 diff -ruN $FILE $TEMPDIR/$PACKAGE/$FILE > $REPORTDIR/$REPORT_NAME.diff
131 if [ $(stat -c '%s' $REPORTDIR/$REPORT_NAME.diff) -eq 0 ];
133 rm -f $REPORTDIR/$REPORT_NAME.diff