if [ "x$PACKAGE" = "x" ];
then
echo "Argument missing."
- exit 1
+ return 1
fi
FILEPATH=$(apt-cache show $PACKAGE | grep ^Filename | cut -d ' ' -f 2-)
if [ "x$FILEPATH" = "x" ];
then
echo "Package '$PACKAGE' does not exist."
- exit 1
+ return 1
fi
ARCHIVE=$(basename $FILEPATH)
if [ "x$ETCBASEDIR" = "x" ];
then
echo "Argument missing."
- exit 1
+ return 1
fi
REPORT_NAME=$(basename $ETCBASEDIR)
# Report diff between debian conf and our local one
rm -f $REPORTDIR/$REPORT_NAME.diff
- find $PREFIX/etc -type f | \
+ [ -d $PREFIX/etc ] && find $PREFIX/etc -type f | \
while read file;
do
diff -ruN $ETCBASEDIR/${file#$PREFIX/} ${file#$PREFIX} >> $REPORTDIR/$REPORT_NAME.diff
# Report symlinks in /etc
rm -f $REPORTDIR/$REPORT_NAME.symlinks
- find $PREFIX/etc -type l | \
+ [ -d $PREFIX/etc ] && find $PREFIX/etc -type l | \
while read file;
do
stat -c '%N' $file >> $REPORTDIR/$REPORT_NAME.symlinks
fi
echo "Getting package $p..."
- _get_unpack_package $p
+ if ! _get_unpack_package $p;
+ then
+ continue
+ fi
# save the original etc dir for later processing
- cp -ir $TEMPDIR/$PACKAGE/etc $TEMPDIR/__debian_etc
+ if [ ! -d $TEMPDIR/$p/etc ];
+ then
+ echo "Warning: package $p does not have any /etc, but 'dpkg -L' shows it"
+ continue
+ else
+ cp -ir $TEMPDIR/$p/etc $TEMPDIR/__debian_etc
+ fi
done
_do_etcdiff $TEMPDIR/__debian_etc
if [ "x$PACKAGE" = "x" ];
then
echo "Argument missing."
- exit 1
+ return 1
fi
if dpkg --status $PACKAGE | grep -q 'not-installed';
return 1
fi
- _get_unpack_package $PACKAGE
+ if ! _get_unpack_package $PACKAGE;
+ then
+ return 1
+ fi
- _do_etcdiff $TEMPDIR/$PACKAGE $TEMPDIR/$PACKAGE
+ if [ ! -d $TEMPDIR/$PACKAGE/etc ];
+ then
+ echo "Warning: package $p does not have any /etc, but 'dpkg -L' shows it"
+ return 1
+ fi
+
+ if ! _do_etcdiff $TEMPDIR/$PACKAGE $TEMPDIR/$PACKAGE;
+ then
+ return 1
+ fi
return 0
}
if [ "x$FILE" = "x" ];
then
echo "Argument missing."
- exit 1
+ return 1
fi
if [ ! -e $FILE ];
then
diff -ruN /dev/null $FILE > $REPORTDIR/$REPORT_NAME.diff
else
- _get_unpack_package $PACKAGE
+ if ! _get_unpack_package $PACKAGE;
+ then
+ return 1
+ fi
diff -ruN $FILE $TEMPDIR/$PACKAGE/$FILE > $REPORTDIR/$REPORT_NAME.diff
fi