home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd2.bin / suse / inst-sys / lib / YaST2 / servers_non_y2 / ag_instsource < prev    next >
Encoding:
Text File  |  2000-03-30  |  623 b   |  36 lines

  1. #! /bin/bash
  2.  
  3. #
  4. # This is an agent for the access to the the installation
  5. # medium. It can mount and unmount a cd, read the number
  6. # of the mounted cd.
  7. #
  8.  
  9. exec 2>/dev/null
  10.  
  11. while true ; do
  12.     read COMMAND || exit
  13.  
  14.     case "$COMMAND" in
  15.     "result("*)
  16.         exit
  17.         ;;
  18.     "Read(.cdnum)")
  19.         NUMFILE=$(cd "/var/adm/mount" ; ls .*-disk-???.* | head -1)
  20.         if [ -z "$NUMFILE" -o ! -r "/var/adm/mount/$NUMFILE" ] ; then
  21.         echo "nil";
  22.         else
  23.         echo "$NUMFILE" | sed 's/.*-disk-0*\([0-9]\+\)\..*/\1/'
  24.             fi
  25.         ;;
  26.          
  27.         "Dir("*)
  28.             echo "[]"
  29.         ;;
  30.  
  31.     *)
  32.         echo "nil"
  33.         ;;
  34.     esac
  35. done
  36.