summaryrefslogtreecommitdiff
path: root/cdeject.sh
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2014-11-21 18:07:24 +0200
committerBlackNoxis <steven.darklight@gmail.com>2014-11-21 18:07:24 +0200
commitdacc0bfae08c88125035f08cd136641eee95137f (patch)
treeb2af748741e2ab9ebca0f57d8ce32b5bc75b1a58 /cdeject.sh
Kogaion live git added
Diffstat (limited to 'cdeject.sh')
-rw-r--r--cdeject.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/cdeject.sh b/cdeject.sh
new file mode 100644
index 0000000..ae75ae8
--- /dev/null
+++ b/cdeject.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+is_live=$(cat /proc/cmdline | grep cdroot)
+
+if [ -n "${is_live}" ]; then
+ cdrom_dev=$(cat /proc/mounts | grep " /mnt/cdrom " | cut -d" " -f 1)
+ # check if /mnt/cdrom device is a cdrom device
+ if [ "${cdrom_dev}" = /dev/sr* ] || [ "${cdrom_dev}" = /dev/cdrom* ]; then
+ eject -mp "${cdrom_dev}" &> /dev/null
+ fi
+fi
+