7 if [ "x$PACKAGE" = "x" ];
9 echo "Argument missing."
13 FILEPATH=$(apt-cache show $PACKAGE | grep ^Filename | cut -d ' ' -f 2-)
15 if [ "x$FILEPATH" = "x" ];
17 echo "Package '$PACKAGE' does not exist."
21 ARCHIVE=$(basename $FILEPATH)
23 wget -q -nc -c $DEBIANMIRROR/$FILEPATH -P $CACHEDIR && \
24 ([ -d $TEMPDIR/$PACKAGE ] || mkdir $TEMPDIR/$PACKAGE) && \
25 dpkg -x $CACHEDIR/$ARCHIVE $TEMPDIR/$PACKAGE
33 if [ "x$ETCBASEDIR" = "x" ];
35 echo "Argument missing."
39 REPORT_NAME=$(basename $ETCBASEDIR)
41 # Report diff between debian conf and our local one
42 rm -f $REPORTDIR/$REPORT_NAME.diff
43 find $PREFIX/etc -type f | \
46 diff -ruN $ETCBASEDIR/${file#$PREFIX/} ${file#$PREFIX} >> $REPORTDIR/$REPORT_NAME.diff
49 # Report symlinks in /etc
50 rm -f $REPORTDIR/$REPORT_NAME.symlinks
51 find $PREFIX/etc -type l | \
54 stat -c '%N' $file >> $REPORTDIR/$REPORT_NAME.symlinks
60 PACKAGES=$(dpkg --get-selections | grep 'install$' | cut -f 1 -d ' ')
62 rm $PROMPT_RM -rf $TEMPDIR/__debian_etc && mkdir $TEMPDIR/__debian_etc
67 # Skip packages which don't put anything in /etc
68 if ! dpkg -L $p | grep -q '/etc/';
73 echo "Getting package $p..."
74 _get_unpack_package $p
76 # save the original etc dir for later processing
77 cp -ir $TEMPDIR/$PACKAGE/etc $TEMPDIR/__debian_etc
80 _do_etcdiff $TEMPDIR/__debian_etc
82 rm -rf $TEMPDIR/__debian_etc
89 if [ "x$PACKAGE" = "x" ];
91 echo "Argument missing."
95 if dpkg --status $PACKAGE | grep -q 'not-installed';
97 echo "Package '$PACKAGE' not installed"
101 # Skip packages which don't put anything in /etc
102 if ! dpkg -L $PACKAGE | grep -q '/etc/';
104 echo "$PACKAGE does not put any file in /etc"
108 _get_unpack_package $PACKAGE
110 _do_etcdiff $TEMPDIR/$PACKAGE $TEMPDIR/$PACKAGE
119 if [ "x$FILE" = "x" ];
121 echo "Argument missing."
127 echo "ERROR, file $FILE does not exist."
133 echo "ERROR, file $FILE is not a regular file."
137 if [ $FILE = ${FILE#/etc/} ];
139 echo "ERROR, file path must begin with /etc/."
143 # Find out which installed package provides the config file
144 PACKAGE=$(dpkg-query -S "$FILE" | cut -d ':' -f 1 | uniq 2> /dev/null)
146 REPORT_NAME=$(basename $FILE)
148 if [ "x$PACKAGE" = "x" ];
150 diff -ruN /dev/null $FILE > $REPORTDIR/$REPORT_NAME.diff
152 _get_unpack_package $PACKAGE
153 diff -ruN $FILE $TEMPDIR/$PACKAGE/$FILE > $REPORTDIR/$REPORT_NAME.diff
156 if [ $(stat -c '%s' $REPORTDIR/$REPORT_NAME.diff) -eq 0 ];
158 rm -f $REPORTDIR/$REPORT_NAME.diff