lintian doesn't like orphan packages with uploaders...
[debian/amanda] / changer-src / chg-multi.sh
index ddb5301698c7515e500e5453c3993493b5a49913..f3ca6c75c0ef59475fe9aa76e3bf4a01ec88e663 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Amanda, The Advanced Maryland Automatic Network Disk Archiver
 # Copyright (c) 1991-1999 University of Maryland at College Park
+# Copyright (c) 2007-2012 Zmanda, Inc.  All Rights Reserved.
 # All Rights Reserved.
 #
 # Permission to use, copy, modify, distribute, and sell this software and its
@@ -125,6 +126,42 @@ if [ -z "$ourstate" ]; then
        exit 2
 fi
 
+if [ -f "$ourstate" -a ! -r "$ourstate" ]; then
+       answer=`_ "<none> %s: Can't read the statefile %s" "$pname" "$ourstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+if [ -f "$ourstate" -a ! -w "$ourstate" ]; then
+       answer=`_ "<none> %s: Can't write the statefile %s" "$pname" "$ourstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+dirstate=`dirname $ourstate`
+if [ ! -e "$dirstate" ]; then
+       answer=`_ "<none> %s: Directory %s doesn't exist" "$pname" "$dirstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+if [ ! -d "$dirstate" ]; then
+       answer=`_ '<none> %s: %s must be a directory' "$pname" "$dirstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+if [ ! -w "$dirstate" ]; then
+       answer=`_ "<none> %s: Can't write to %s directory" "$pname" "$dirstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
 # needeject and multieject are incompatible
 if [ $needeject -eq 1 ] && [ $multieject -eq 1 ] ; then
        answer=`_ '<none> %s: needeject and multieject cannot be both enabled in %s' "$pname" "$ourconf"`
@@ -405,7 +442,7 @@ echo curloaded $curloaded                    >> $ourstate
 # return slot info
 
 if [ $slotempty -eq 1 ]; then
-       answer=`_ '%s %s: slot is empty' "$newslot" "$pname"`
+       answer=`_ '%s %s: slot is empty: %s' "$newslot" "$pname" "$amdevcheck_message"`
        echo `_ 'Exit ->'` $answer >> $logfile
        echo $answer
        exit 1