nldev

NetLink DEVice manager; a lightweight netlink frontend for mdev.
git clone git://r-36.net/nldev
Log | Files | Refs | README | LICENSE

ttydev (840B)


      1 #!/bin/busybox ash
      2 
      3 #
      4 # This will work, but it is a useless overhead for every tty
      5 # that might be created. Only use it, if there is really some
      6 # dirty compatibility with udev that won't resolve otherwise!
      7 # You have been warned!
      8 #
      9 
     10 # $MDEV
     11 # $ACTION
     12 
     13 if [ "${MDEV}" = "console" ] || [ "${MDEV}" = "null" ];
     14 then
     15 	chmod 600 ${MDEV}
     16 fi
     17 
     18 CHAR=""
     19 [ -e /sys${DEVPATH}/dev ] && CHAR=$(cat /sys${DEVPATH}/dev)
     20 
     21 case "$ACTION" in
     22 	add|"")
     23 		if [ -n "${CHAR}" ];
     24 		then
     25 			mkdir -p char
     26 			cd char
     27 			[ -e "${CHAR}" ] && rm -f ${CHAR}
     28 			ln -s ../${MDEV} ${CHAR}
     29 			cd ..
     30 		fi
     31 		;;
     32 	remove)
     33 		[ -e char/${CHAR} ] && rm -f char/${CHAR}
     34 
     35 		if [ -e char ];
     36 		then
     37 			cd char
     38 			SLS=$(ls -l \
     39 				| awk "/..\/${MDEV}/ {print \$9 }")
     40 			for FILE in ${SLS};
     41 			do
     42 				rm -f ${FILE}
     43 			done
     44 			cd ..
     45 			
     46 			rmdir char 2>/dev/null
     47 		fi
     48 		;;
     49 esac
     50 
     51 exit 0
     52