summaryrefslogtreecommitdiff
path: root/scripts/mount.sh
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2005-07-19 15:09:05 +0000
committerAndreas Brachold <vdr07@deltab.de>2005-07-19 15:09:05 +0000
commitf897f2aa7055c493db6391c50c8d19da970078e8 (patch)
treed13a515b24c149d7da4e9828cc9e9c73d4916f00 /scripts/mount.sh
downloadvdr-plugin-image-f897f2aa7055c493db6391c50c8d19da970078e8.tar.gz
vdr-plugin-image-f897f2aa7055c493db6391c50c8d19da970078e8.tar.bz2
Initial import with release 0.2.3
Diffstat (limited to 'scripts/mount.sh')
-rwxr-xr-xscripts/mount.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/mount.sh b/scripts/mount.sh
new file mode 100755
index 0000000..65cb6e0
--- /dev/null
+++ b/scripts/mount.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# This script is called from VDR to mount/unmount/eject
+# the sources for MP3 play and/or image sources,
+#
+# 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
+#
+# ok -> changed mount to not abort, if eject -t did fail, e.g. for a usb storage device
+
+action="$1"
+path="$2"
+
+case "$action" in
+mount)
+ eject -t "$path" &>/dev/null # close the tray, but not do/print anything if that fails
+ 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
+ if [ $? -ne 0 ]; then # not mounted ...
+ exit 1
+ fi
+esac
+
+exit 0