examples/mount.sh.example
author nathan
Sun, 12 Dec 2010 11:31:54 +0100
branchtrunk
changeset 38 79b272a68eb4
parent 0 474a1293c3c0
permissions -rw-r--r--
fix compile without OGG library
     1 #!/bin/bash
     2 #
     3 # This script is called from VDR to mount/unmount/eject
     4 # the sources for MP3 play.
     5 #
     6 # argument 1: wanted action, one of mount,unmount,eject,status
     7 # argument 2: mountpoint to act on
     8 #
     9 # mount,unmount,eject must return 0 if succeeded, 1 if failed
    10 # status must return 0 if device is mounted, 1 if not
    11 #
    12 
    13 action="$1"
    14 path="$2"
    15 
    16 case "$action" in
    17 mount)
    18   eject -t "$path" || exit 1         # close the tray
    19   mount "$path" || exit 1            # mount it
    20   ;;
    21 unmount)
    22   umount "$path" || exit 1           # unmount it
    23   ;;
    24 eject)
    25   eject "$path" || exit 1            # eject disk
    26   ;;
    27 status)
    28   cat /proc/mounts | grep -q "$path" # check if mounted
    29   if [ $? -ne 0 ]; then              # not mounted ...
    30     exit 1
    31   fi
    32 esac
    33 
    34 exit 0