X-Git-Url: https://git.ao2.it/etcdiff.git/blobdiff_plain/027b94126052f26966a0966d6790222fadea7e2f..273361f63d944f4191b696ff0c3461ffa28bbfb6:/etcdiff.include diff --git a/etcdiff.include b/etcdiff.include index e26498c..c82468d 100644 --- a/etcdiff.include +++ b/etcdiff.include @@ -3,6 +3,13 @@ _get_unpack_package() { PACKAGE=$1 + + if [ "x$PACKAGE" = "x" ]; + then + echo "Argument missing." + exit 1 + fi + FILEPATH=$(apt-cache show $PACKAGE | grep ^Filename | cut -d ' ' -f 2-) if [ "x$FILEPATH" = "x" ]; @@ -23,6 +30,12 @@ _do_etcdiff() ETCBASEDIR=$1 PREFIX=$2 + if [ "x$ETCBASEDIR" = "x" ]; + then + echo "Argument missing." + exit 1 + fi + REPORT_NAME=$(basename $ETCBASEDIR) # Report diff between debian conf and our local one @@ -42,7 +55,7 @@ _do_etcdiff() done } -etchdiff_system() +etcdiff_system() { PACKAGES=$(dpkg --get-selections | grep 'install$' | cut -f 1 -d ' ') @@ -73,6 +86,12 @@ etcdiff_by_package() { PACKAGE=$1 + if [ "x$PACKAGE" = "x" ]; + then + echo "Argument missing." + exit 1 + fi + if dpkg --status $PACKAGE | grep -q 'not-installed'; then echo "Package '$PACKAGE' not installed" @@ -97,6 +116,12 @@ etcdiff_by_file() { FILE=$1 + if [ "x$FILE" = "x" ]; + then + echo "Argument missing." + exit 1 + fi + if [ ! -e $FILE ]; then echo "ERROR, file $FILE does not exist."