From: Antonio Ospite Date: Thu, 28 Jan 2010 21:00:31 +0000 (+0100) Subject: Add usage info, and command line arguments. X-Git-Url: https://git.ao2.it/etcdiff.git/commitdiff_plain/bf052f6a6a376d6f0c4e93bd606d2674718a9f06?ds=inline Add usage info, and command line arguments. --- diff --git a/etcdiff.sh b/etcdiff.sh index 3014c4b..4ee0212 100755 --- a/etcdiff.sh +++ b/etcdiff.sh @@ -1,7 +1,7 @@ #!/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 # License: GPLv2 or later @@ -18,34 +18,56 @@ TEMPDIR=${BASEDIR}/temp CACHEDIR=${BASEDIR}/cache REPORTDIR=${BASEDIR}/reports +usage() +{ + echo "usage: $0 [|] + +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