#!/bin/sh
#
# etcdiff (deb-etcdiff?) shows how your current /etc dir
-# diverges from the debian distribution standard one.
+# diverges from the debian default one.
#
# Copyright (C) 2008,2009,2010 Antonio Ospite <ospite@studenti.unina.it>
# License: GPLv2 or later
CACHEDIR=${BASEDIR}/cache
REPORTDIR=${BASEDIR}/reports
+usage()
+{
+ echo "usage: $0 <file|package|system> [<file name>|<package name>]
+
+etcdiff shows how your /etc dir differs from the debian default one
+
+etcdiff by explicit file list:
+ FILES='/etc/sysctl.conf /etc/updatedb.conf'
+ for file in \$FILES;
+ do
+ $0 file \$file
+ done
+
+etcdiff bycommand generated file list
+ FILES=\$(find /etc/apache2 -type f -perm /o+r | grep -v '.dpkg-')
+ for file in \$FILES;
+ do
+ $0 file \$file
+ done
+
+etcdiff by package name
+ $0 package cherokee
+ $0 package mlocate
+ $0 package apache2-doc
+ $0 package apache2.2-common
+ $0 package libapache2-mod-php5
+ $0 package hostapd
+
+etcdiff the whole /etc system directory
+ $0 system
+"
+}
+
rm $PROMPT_RM -rf $TEMPDIR && mkdir $TEMPDIR
rm $PROMPT_RM -rf $CACHEDIR && mkdir $CACHEDIR
rm $PROMPT_RM -rf $REPORTDIR && mkdir $REPORTDIR
. $BASEDIR/etcdiff.include
-# Examples of file query
-
-# by explicit file list
-#FILES="/etc/sysctl.conf /etc/updatedb.conf"
-#for file in $FILES;
-#do
-# etcdiff_by_file $file
-#done
-
-# by file list generated by a command
-#FILES=$(find /etc/apache2 -type f -perm /o+r | grep -v '.dpkg-')
-#for file in $FILES;
-#do
-# etcdiff_by_file $file
-#done
-
-# by package name
-#etcdiff_by_package cherokee
-#etcdiff_by_package mlocate
-#etcdiff_by_package apache2-doc
-#etcdiff_by_package apache2.2-common
-#etcdiff_by_package libapache2-mod-php5
-#etcdiff_by_package hostapd
-
-#etchdiff_system
+case $1 in
+ file)
+ etcdiff_by_file $2
+ ;;
+ package)
+ etcdiff_by_package $2
+ ;;
+ system)
+ etcdiff_system
+ ;;
+ *)
+ usage
+ ;;
+esac