packages: VirtualBox/VirtualBox-vboxnetadp.init - also create the device
glen
glen at pld-linux.org
Sat Mar 24 13:46:44 CET 2012
Author: glen Date: Sat Mar 24 12:46:44 2012 GMT
Module: packages Tag: HEAD
---- Log message:
- also create the device
---- Files affected:
packages/VirtualBox:
VirtualBox-vboxnetadp.init (1.2 -> 1.3)
---- Diffs:
================================================================
Index: packages/VirtualBox/VirtualBox-vboxnetadp.init
diff -u packages/VirtualBox/VirtualBox-vboxnetadp.init:1.2 packages/VirtualBox/VirtualBox-vboxnetadp.init:1.3
--- packages/VirtualBox/VirtualBox-vboxnetadp.init:1.2 Tue Jan 11 23:41:50 2011
+++ packages/VirtualBox/VirtualBox-vboxnetadp.init Sat Mar 24 13:46:39 2012
@@ -18,23 +18,59 @@
# Get service config - may override defaults
[ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
+setup() {
+ modprobe -s $VBOX_MODULE
+ RETVAL=$?
+ if [ -d /dev/.udev ]; then
+ return $RETVAL
+ fi
+
+ # set proper $VBOX_DEVICE for systems with static dev
+ show "Setting $VBOX_DEVICE entry"; busy
+ rm -f $VBOX_DEVICE
+ VBOX_MAJOR=$(awk -vdevice="${VBOX_DEVICE#/dev/}" '$2 == device {print $1}' /proc/devices)
+ if [ -n "$VBOX_MAJOR" ]; then
+ VBOX_MINOR=0
+ else
+ VBOX_MINOR=$(awk -vdevice="${VBOX_DEVICE#/dev/}" '$2 == device {print $1}' /proc/misc)
+ if [ -n "$VBOX_MINOR" ]; then
+ VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices)
+ fi
+ fi
+
+ if [ -z "$VBOX_MAJOR" ]; then
+ /sbin/rmmod $VBOX_MODULE
+ RETVAL=1
+ elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then
+ RETVAL=$?
+ rmmod $VBOX_MODNAME
+ fail
+ elif ! chown root:vbox $VBOX_DEVICE; then
+ RETVAL=$?
+ fail
+ else
+ ok
+ fi
+ return $RETVAL
+}
+
start() {
- if [ -f /var/lock/subsys/vboxnetadp ]; then
+ if [ -f /var/lock/subsys/$VBOX_MODULE ]; then
return
fi
- modprobe -s $VBOX_MODULE
- touch /var/lock/subsys/vboxnetadp
+ setup || exit $?
+ touch /var/lock/subsys/$VBOX_MODULE
}
stop() {
# NOTE: rmmod will wait if device is in use, so automatic rmmod probably is not the best idea
/sbin/rmmod $VBOX_MODULE
- rm -f /var/lock/subsys/vboxnetadp
+ rm -f /var/lock/subsys/$VBOX_MODULE
}
condrestart() {
- if [ -f /var/lock/subsys/vboxnetadp ]; then
+ if [ -f /var/lock/subsys/$VBOX_MODULE ]; then
stop
start
else
@@ -61,6 +97,9 @@
force-reload)
condrestart 7
;;
+ setup)
+ setup
+ ;;
status)
if ! is_module $VBOX_MODULE; then
echo "$VBOX_MODULE module is loaded"
@@ -68,9 +107,15 @@
echo "$VBOX_MODULE module is not loaded"
RETVAL=3
fi
+ if [ ! -c $VBOX_DEVICE ]; then
+ echo "$VBOX_DEVICE does not exist"
+ RETVAL=3
+ else
+ echo "$VBOX_DEVICE exists with major/minor $(ls -l $VBOX_DEVICE | awk '{print $5 $6}')"
+ fi
;;
*)
- msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload|setup|status}"
exit 3
esac
================================================================
---- CVS-web:
http://cvs.pld-linux.org/packages/VirtualBox/VirtualBox-vboxnetadp.init?r1=1.2&r2=1.3
More information about the pld-cvs-commit
mailing list