home *** CD-ROM | disk | FTP | other *** search
- #! /bin/bash
-
- #
- # This is an agent for the access to the the installation
- # medium. It can mount and unmount a cd, read the number
- # of the mounted cd.
- #
-
- exec 2>/dev/null
-
- while true ; do
- read COMMAND || exit
-
- case "$COMMAND" in
- "result("*)
- exit
- ;;
- "Read(.cdnum)")
- NUMFILE=$(cd "/var/adm/mount" ; ls .*-disk-???.* | head -1)
- if [ -z "$NUMFILE" -o ! -r "/var/adm/mount/$NUMFILE" ] ; then
- echo "nil";
- else
- echo "$NUMFILE" | sed 's/.*-disk-0*\([0-9]\+\)\..*/\1/'
- fi
- ;;
-
- "Dir("*)
- echo "[]"
- ;;
-
- *)
- echo "nil"
- ;;
- esac
- done
-