projects
/
etcdiff.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check arguments in functions
[etcdiff.git]
/
etcdiff.include
diff --git
a/etcdiff.include
b/etcdiff.include
index
e26498c
..
44564d8
100644
(file)
--- a/
etcdiff.include
+++ b/
etcdiff.include
@@
-3,6
+3,13
@@
_get_unpack_package()
{
PACKAGE=$1
_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" ];
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
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
REPORT_NAME=$(basename $ETCBASEDIR)
# Report diff between debian conf and our local one
@@
-73,6
+86,12
@@
etcdiff_by_package()
{
PACKAGE=$1
{
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"
if dpkg --status $PACKAGE | grep -q 'not-installed';
then
echo "Package '$PACKAGE' not installed"
@@
-97,6
+116,12
@@
etcdiff_by_file()
{
FILE=$1
{
FILE=$1
+ if [ "x$FILE" = "x" ];
+ then
+ echo "Argument missing."
+ exit 1
+ fi
+
if [ ! -e $FILE ];
then
echo "ERROR, file $FILE does not exist."
if [ ! -e $FILE ];
then
echo "ERROR, file $FILE does not exist."