Imported Upstream version 2.6.1
[debian/amanda] / changer-src / chg-multi.sh
index ddb5301698c7515e500e5453c3993493b5a49913..19ffb4122b2e3116988446e12eb25176c3b50cdd 100644 (file)
@@ -125,6 +125,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 +441,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