# No user-level customization should be required beyond this point.
################################################################################
+####
+# Set up paths, including PATH for finding amanda executables
+
+PATH="$PATH:@sbindir@:@libexecdir@"
prefix="@prefix@"
exec_prefix="@exec_prefix@"
sbindir="@sbindir@"
libexecdir="@libexecdir@"
-amlibexecdir="@amlibexecdir@"
-. "${amlibexecdir}/amanda-sh-lib.sh"
+
+####
+# Gettext
+
+#+
+# Function to:
+# Simplify gettext usage by allowing printf format
+# strings for translators, use _() identifier for
+# xgettext extraction similar to "C" usage and
+# collapsing "printf `gettext fmt` ...", which is
+# used everywhere, into one function.
+#-
+_() {
+ fmt=`gettext -d amanda "$1"`
+ shift
+ printf "$fmt" $*
+}
####
# Eponymous functions to access various amanda apps
# on device status, since some devices can't differentiate between device
# problems and an unlabeled volume.
amdevcheck_status() {
- amdevcheck_config_dir=`pwd`
- amdevcheck_config_name=`basename $amdevcheck_config_dir`
- amdevcheck_output=`amdevcheck $amdevcheck_config_name $@`
-
- if test $? -eq 0 || \
- echo $amdevcheck_output | grep UNLABELED > /dev/null; then
- return 0
+ amdevcheck_message=
+ local amdevcheck_config_dir=`pwd`
+ local amdevcheck_config_name=`basename $amdevcheck_config_dir`
+ local amdevcheck_output=`amdevcheck $amdevcheck_config_name $@`
+ local amdevcheck_status=$?
+
+ test "$amdevcheck_status" -ne 0 && return 0
+
+ # extract any messages
+ amdevcheck_message=`echo "$amdevcheck_output" | sed '/^MESSAGE /{s/^MESSAGE //;p;}; d'`
+
+ # Return 1 if it's possible that the device is offline or busy; if the device cannot
+ # distinguish this state from an error condition, then our caller will just have to
+ # time out
+ if echo "$amdevcheck_output" | $EGREP "VOLUME_MISSING" > /dev/null; then
+ return 1
else
- return 1
+ return 0
fi
}