examples/mount.sh.example
branchtrunk
changeset 0 474a1293c3c0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/examples/mount.sh.example	Sat Dec 29 14:47:40 2007 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +#!/bin/bash
     1.5 +#
     1.6 +# This script is called from VDR to mount/unmount/eject
     1.7 +# the sources for MP3 play.
     1.8 +#
     1.9 +# argument 1: wanted action, one of mount,unmount,eject,status
    1.10 +# argument 2: mountpoint to act on
    1.11 +#
    1.12 +# mount,unmount,eject must return 0 if succeeded, 1 if failed
    1.13 +# status must return 0 if device is mounted, 1 if not
    1.14 +#
    1.15 +
    1.16 +action="$1"
    1.17 +path="$2"
    1.18 +
    1.19 +case "$action" in
    1.20 +mount)
    1.21 +  eject -t "$path" || exit 1         # close the tray
    1.22 +  mount "$path" || exit 1            # mount it
    1.23 +  ;;
    1.24 +unmount)
    1.25 +  umount "$path" || exit 1           # unmount it
    1.26 +  ;;
    1.27 +eject)
    1.28 +  eject "$path" || exit 1            # eject disk
    1.29 +  ;;
    1.30 +status)
    1.31 +  cat /proc/mounts | grep -q "$path" # check if mounted
    1.32 +  if [ $? -ne 0 ]; then              # not mounted ...
    1.33 +    exit 1
    1.34 +  fi
    1.35 +esac
    1.36 +
    1.37 +exit 0