aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox-initscripts/ide_links
diff options
context:
space:
mode:
Diffstat (limited to 'main/busybox-initscripts/ide_links')
-rw-r--r--main/busybox-initscripts/ide_links23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/busybox-initscripts/ide_links b/main/busybox-initscripts/ide_links
new file mode 100644
index 0000000000..be0c95aa9c
--- /dev/null
+++ b/main/busybox-initscripts/ide_links
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+[ -f /proc/ide/$MDEV/media ] || exit
+
+media=`cat /proc/ide/$MDEV/media`
+for i in $media $media[0-9]* ; do
+ if [ "`readlink $i 2>/dev/null`" = $MDEV ] ; then
+ LINK=$i
+ break
+ fi
+done
+
+# link exist, remove if necessary and exit
+if [ "$LINK" ] ; then
+ [ "$ACTION" = remove ] && rm $LINK
+ exit
+fi
+
+# create a link
+num=`ls $media[0-9]* 2>/dev/null | wc -l`
+ln -sf $MDEV "$media`echo $num`"
+[ -e "$media" ] || ln -sf $MDEV "$media"
+