+# mt status output
+# SunOS No Additional Sense
+# FreeBSD Current Driver State: at rest.
+# Linux ONLINE
+# Note Debian has a different mt than the standard Linux version.
+# When no tape is in the drive it waits 2 minutes.
+# When a tape is in the drive, it prints user unfriendly output.
+#
+
+OS=`uname`
+case ${OS} in
+ SunOS)
+ ready="No Additional Sense"
+ ;;
+ FreeBSD)
+ ready="Current Driver State: at rest."
+ ;;
+ Linux)
+ if test -e /etc/debian_version ; then
+ ready="drive status"
+ else
+ ready="ONLINE"
+ fi
+ ;;
+esac
+
+#
+# log whats done
+#
+# to turn on logging, uncomment the following line
+#touch @working_dir@/mtx.log
+#
+dbgfile="@working_dir@/mtx.log"
+debug() {
+ if test -f $dbgfile; then
+ echo "`date +\"%Y%m%d-%H:%M:%S\"` $*" >> $dbgfile
+ fi
+}
+
+
+#
+# Create a temporary file
+#
+make_temp_file() {
+ TMPFILE=`mktemp @working_dir@/mtx.XXXXXXXXXX`
+ if test x${TMPFILE} = x; then
+ TMPFILE="@working_dir@/mtx.$$"
+ if test -f ${TMPFILE}; then
+ echo "Temp file security problem on: ${TMPFILE}"
+ exit 1
+ fi
+ fi
+}
+