summaryrefslogtreecommitdiff
path: root/vdr/scripts/vdrmount
diff options
context:
space:
mode:
authorroot <root@elwms02.(none)>2010-04-06 16:13:08 +0200
committerroot <root@elwms02.(none)>2010-04-06 16:13:08 +0200
commit0e7005fcc7483c01aa102fbea358c5ac65a48d62 (patch)
tree11517ce0d3d2977c6732b3aa583b0008083e0bd3 /vdr/scripts/vdrmount
downloadx-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.gz
x-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.bz2
hello world
Diffstat (limited to 'vdr/scripts/vdrmount')
-rw-r--r--vdr/scripts/vdrmount35
1 files changed, 35 insertions, 0 deletions
diff --git a/vdr/scripts/vdrmount b/vdr/scripts/vdrmount
new file mode 100644
index 0000000..0be7b02
--- /dev/null
+++ b/vdr/scripts/vdrmount
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# This script is called from VDR to mount/unmount/eject
+# the sources for MP3 play.
+#
+# argument 1: wanted action, one of mount,unmount,eject,status
+# argument 2: mountpoint to act on
+#
+# mount,unmount,eject must return 0 if succeeded, 1 if failed
+# status must return 0 if device is mounted, 1 if not
+#
+
+action="$1"
+path="$2"
+
+case "$action" in
+ mount)
+ if [ -z "$(echo $path | grep "usb")" ]; then
+ eject -t "$path" || exit 1 # close the tray
+ fi
+ mount "$path" || exit 1 # mount it
+ ;;
+ unmount)
+ umount "$path" || exit 1 # unmount it
+ ;;
+ eject)
+ eject "$path" || exit 1 # eject disk
+ ;;
+ status)
+ cat /proc/mounts | grep -q "$path" # check if mounted
+ [ $? -ne 0 ] && exit 1 # not mounted ...
+ ;;
+esac
+
+exit 0