ALT Linux repos
S: | 7.0.10-alt2 |
5.0: | 3.0.4-alt0.M50.1 |
4.1: | 2.1.4-alt0.M41.5 |
4.0: | |
+backports: | 1.6.6-alt0.M40.2 |
Group :: Emulators
RPM: virtualbox
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: VirtualBox-alt-init-scripts.diff
Download
Download
diff --git a/VirtualBox/src/VBox/Additions/linux/installer/vboxadd-timesync.sh b/VirtualBox/src/VBox/Additions/linux/installer/vboxadd-timesync.sh
index f72661e..4832fa2 100644
--- a/VirtualBox/src/VBox/Additions/linux/installer/vboxadd-timesync.sh
+++ b/VirtualBox/src/VBox/Additions/linux/installer/vboxadd-timesync.sh
@@ -30,178 +30,82 @@
# Description: VirtualBox Additions timesync
### END INIT INFO
-PATH=$PATH:/bin:/sbin:/usr/sbin
+# Do not load RH compatibility interface.
+WITHOUT_RC_COMPAT=1
-system=unknown
-if [ -f /etc/redhat-release ]; then
- system=redhat
- PIDFILE="/var/lock/subsys/vboxadd-timesync"
-elif [ -f /etc/SuSE-release ]; then
- system=suse
- PIDFILE="/var/lock/subsys/vboxadd-timesync"
-elif [ -f /etc/debian_version ]; then
- system=debian
- PIDFILE="/var/run/vboxadd-timesync"
-elif [ -f /etc/gentoo-release ]; then
- system=gentoo
- PIDFILE="/var/run/vboxadd-timesync"
-else
- system=other
- if [ -d /var/run -a -w /var/run ]; then
- PIDFILE="/var/run/vboxadd-timesync"
- fi
-fi
+# Source function library.
+. /etc/init.d/functions
-if [ "$system" = "redhat" ]; then
- . /etc/init.d/functions
- fail_msg() {
- echo_failure
- echo
- }
-
- succ_msg() {
- echo_success
- echo
- }
-fi
-
-if [ "$system" = "suse" ]; then
- . /etc/rc.status
- daemon() {
- startproc ${1+"$@"}
- }
-
- fail_msg() {
- rc_failed 1
- rc_status -v
- }
-
- succ_msg() {
- rc_reset
- rc_status -v
- }
-fi
-
-if [ "$system" = "debian" ]; then
- daemon() {
- start-stop-daemon --start --exec $1 -- $2
- }
-
- killproc() {
- start-stop-daemon --stop --exec $@
- }
-
- fail_msg() {
- echo " ...fail!"
- }
-
- succ_msg() {
- echo " ...done."
- }
-fi
-
-if [ "$system" = "gentoo" ]; then
- . /sbin/functions.sh
- daemon() {
- start-stop-daemon --start --exec $1 -- $2
- }
-
- killproc() {
- start-stop-daemon --stop --exec $@
- }
-
- fail_msg() {
- echo " ...fail!"
- }
-
- succ_msg() {
- echo " ...done."
- }
-
- if [ "`which $0`" = "/sbin/rc" ]; then
- shift
- fi
-fi
-
-if [ "$system" = "other" ]; then
- fail_msg() {
- echo " ...fail!"
- }
-
- succ_msg() {
- echo " ...done."
- }
-
- begin() {
- echo -n "$1"
- }
-fi
+LOCKFILE="/var/lock/subsys/vboxadd-timesync"
+PIDFILE="/var/run/vboxadd-timesync"
+RETVAL=0
binary=/usr/sbin/vboxadd-timesync
test -x "$binary" || {
- echo "Cannot run $binary"
- exit 1
-}
-
-vboxaddrunning() {
- lsmod | grep -q "vboxadd[^_-]"
+ echo "Cannot run $binary"
+ exit 1
}
-start() {
- if ! test -f $PIDFILE; then
- echo -n "Starting VirtualBox host to guest time synchronisation ";
- vboxaddrunning || {
- echo "VirtualBox Additions module not loaded!"
- exit 1
- }
- daemon $binary --daemonize
- RETVAL=$?
- test $RETVAL -eq 0 && touch $PIDFILE
- succ_msg
- fi
- return $RETVAL
+vboxaddrunning()
+{
+ lsmod | grep -q "vboxadd[^_-]"
}
-stop() {
- if test -f $PIDFILE; then
- echo -n "Stopping VirtualBox host to guest time synchronisation ";
- vboxaddrunning || {
- echo "VirtualBox Additions module not loaded!"
- exit 1
- }
- killproc $binary
- RETVAL=$?
- test $RETVAL -eq 0 && rm -f $PIDFILE
- succ_msg
- fi
- return $RETVAL
+start()
+{
+ msg_starting $"Starting VirtualBox host to guest time synchronisation"
+ vboxaddrunning || {
+ echo "VirtualBox Additions module not loaded!"
+ exit 1
+ }
+ start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce -- $binary
+ RETVAL=$?
+ return $RETVAL
}
-restart() {
- stop && start
+stop()
+{
+ msg_stopping $"Stopping VirtualBox host to guest time synchronisation"
+ stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce $binary
+ RETVAL=$?
+ return $RETVAL
}
-dmnstatus() {
- status vboxadd-timesync
+restart()
+{
+ stop
+ start
}
+# See how we were called.
case "$1" in
-start)
- start
- ;;
-stop)
- stop
- ;;
-restart)
- restart
- ;;
-status)
- dmnstatus
- ;;
-*)
- echo "Usage: $0 {start|stop|restart|status}"
- exit 1
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ condstop)
+ if [ -e "$LOCKFILE" ]; then
+ stop
+ fi
+ ;;
+ condrestart)
+ if [ -e "$LOCKFILE" ]; then
+ restart
+ fi
+ ;;
+ status)
+ status
+ RETVAL=$?
+ ;;
+ *)
+ msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|status}"
+ RETVAL=1
esac
exit $RETVAL
diff --git a/VirtualBox/src/VBox/Additions/linux/installer/vboxadd.sh b/VirtualBox/src/VBox/Additions/linux/installer/vboxadd.sh
index 3aa7936..7dfaa04 100644
--- a/VirtualBox/src/VBox/Additions/linux/installer/vboxadd.sh
+++ b/VirtualBox/src/VBox/Additions/linux/installer/vboxadd.sh
@@ -30,6 +30,87 @@
# Description: VirtualBox Linux Additions kernel module
### END INIT INFO
+# Do not load RH compatibility interface.
+WITHOUT_RC_COMPAT=1
+
+# Source function library.
+. /etc/init.d/functions
+
+LOCKFILE=/var/lock/subsys/virtualbox-addition
+MODULENAME=vboxadd
+RETVAL=0
+
+running()
+{
+ lsmod | grep -q "$MODULENAME[^_-]"
+}
+
+start()
+{
+ action "Loading VirtualBox module ($MODULENAME):" modprobe $MODULENAME
+ RETVAL=$?
+ [ $RETVAL = 0 ] && touch "$LOCKFILE" ||:
+ return $RETVAL
+}
+
+stop()
+{
+ action "Unloading VirtualBox module ($MODULENAME):" modprobe -r $MODULENAME
+ RETVAL=$?
+ [ $RETVAL = 0 ] && rm -f "$LOCKFILE" ||:
+ return $RETVAL
+}
+
+restart()
+{
+ stop
+ start
+}
+
+status()
+{
+ if /sbin/lsmod | grep -qs "^$MODULENAME[[:space:]]"; then
+ echo "$MODULENAME module is loaded"
+ return 0
+ elif [ -f "$LOCKFILE" ]; then
+ echo "$MODULENAME module is not loaded, but subsystem is locked"
+ return 2
+ else
+ echo "$MODULENAME service is stopped"
+ return 3
+ fi
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ condstop)
+ if [ -e "$LOCKFILE" ]; then
+ stop
+ fi
+ ;;
+ condrestart)
+ # Do nothing on package upgrade
+ ;;
+ status)
+ status
+ RETVAL=$?
+ ;;
+ *)
+ msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|status}"
+ RETVAL=1
+esac
+
+exit $RETVAL
+
PATH=$PATH:/bin:/sbin:/usr/sbin
if [ -f /etc/redhat-release ]; then