VirtualBox

Changeset 57888 in vbox for trunk/src/VBox/Installer/linux


Ignore:
Timestamp:
Sep 24, 2015 6:50:06 PM (9 years ago)
Author:
vboxsync
Message:

Installer/linux/debian: add systemd support.

Location:
trunk/src/VBox/Installer/linux/debian
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/debian/postinst.in

    r56299 r57888  
    9090#DEBHELPER#
    9191
    92 if [ "$1" = "configure" ]; then
    93   # Start vboxdrv/vboxballoonctrl/vboxweb-service manually as we use our own error handling in postrm
    94   if [ -x "/etc/init.d/vboxdrv" ]; then
    95     update-rc.d vboxdrv defaults 20 80 >/dev/null
    96 
    97     BUILD_MODULES=0
    98     REGISTER_MODULES=1
    99     # Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
    100     if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
    101       REGISTER_MODULES=0
    102       if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
    103         db_get virtualbox/module-compilation-allowed
    104         if [ "$RET" = "false" ]; then
    105           cat << EOF
     92BUILD_MODULES=0
     93REGISTER_MODULES=1
     94# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
     95if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
     96  REGISTER_MODULES=0
     97  if [ "$1" = "configure" ]; then
     98    if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
     99      db_get virtualbox/module-compilation-allowed
     100      if [ "$RET" = "false" ]; then
     101        cat << EOF
    106102Unable to find a precompiled module for the current kernel
    107103though module compilation denied by debconf setting.
    108104EOF
    109         else
    110           db_input low virtualbox/module-compilation-allowed || true
    111           db_go || true
    112           db_get virtualbox/module-compilation-allowed
    113           if [ "$RET" = "true" ]; then
    114             BUILD_MODULES=1
    115           fi
     105      else
     106        db_input low virtualbox/module-compilation-allowed || true
     107        db_go || true
     108        db_get virtualbox/module-compilation-allowed
     109        if [ "$RET" = "true" ]; then
     110          BUILD_MODULES=1
    116111        fi
    117112      fi
    118113    fi
     114  fi # $1 = "configure"
     115fi
    119116
    120     if [ $BUILD_MODULES -eq 1 ]; then
    121       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    122         invoke-rc.d vboxdrv setup || true
    123       else
    124         /etc/init.d/vboxdrv setup || true
    125       fi
    126     else
    127       # shipped modules found, register sources at DKMS anyway
    128       if lsmod | grep -q "vboxdrv[^_-]"; then
    129         /etc/init.d/vboxdrv stop || true
    130       fi
    131       if [ $REGISTER_MODULES -eq 1 ]; then
    132         DKMS=`which dkms 2>/dev/null`
    133         if [ -n "$DKMS" ]; then
    134           $DKMS add -m vboxhost -v %VER% > /dev/null 2>&1 || true
    135         fi
    136       fi
    137       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    138         invoke-rc.d vboxdrv start || exit $?
    139       else
    140         /etc/init.d/vboxdrv start || exit $?
    141       fi
    142     fi
    143   fi
    144   if [ -x "/etc/init.d/vboxballoonctrl-service" ]; then
    145     update-rc.d vboxballoonctrl-service defaults 35 65 >/dev/null
    146     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    147         invoke-rc.d vboxballoonctrl-service start || exit $?
    148     else
    149         /etc/init.d/vboxballoonctrl-service start || exit $?
    150     fi
    151   fi
    152   if [ -x "/etc/init.d/vboxautostart-service" ]; then
    153     update-rc.d vboxautostart-service defaults 35 65 >/dev/null
    154     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    155         invoke-rc.d vboxautostart-service start || exit $?
    156     else
    157         /etc/init.d/vboxautostart-service start || exit $?
    158     fi
    159   fi
    160   if [ -x "/etc/init.d/vboxweb-service" ]; then
    161     update-rc.d vboxweb-service defaults 35 65 >/dev/null
    162     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    163         invoke-rc.d vboxweb-service start || exit $?
    164     else
    165         /etc/init.d/vboxweb-service start || exit $?
    166     fi
    167   fi
     117if [ $BUILD_MODULES -eq 1 ]; then
     118  /usr/lib/virtualbox/vboxdrv.sh setup || true
     119fi
    168120
    169 fi # $1 = "configure"
     121# Install and start the new service scripts.
     122PRERM_DKMS=
     123test "${REGISTER_MODULES}" = 1 && PRERM_DKMS="--dkms %VER%"
     124POSTINST_START=--start
     125test "${INSTALL_NO_VBOXDRV}" = 1 && POSTINST_START=
     126/usr/lib/virtualbox/prerm-common.sh ${PRERM_DKMS} || true
     127/usr/lib/virtualbox/postinst-common.sh /usr/lib/virtualbox "${POSTINST_START}" > /dev/null || true
    170128
    171129exit 0
  • trunk/src/VBox/Installer/linux/debian/preinst.in

    r56299 r57888  
    2626  db_capb backup
    2727
    28   # check for active VMs
    29   VBOXSVC_PID=`pidof VBoxSVC 2> /dev/null || true`
    30   if [ -n "$VBOXSVC_PID" ]; then
    31     if [ -f /etc/init.d/vboxballoonctrl-service ]; then
    32       # try graceful termination; terminate the ballon control service first
    33       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    34         invoke-rc.d vboxballoonctrl-service stop || true
    35       else
    36         /etc/init.d/vboxballoonctrl-service stop || true
    37       fi
    38     fi
    39     if [ -f /etc/init.d/vboxweb-service ]; then
    40       # try graceful termination; terminate the webservice first
    41       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    42         invoke-rc.d vboxweb-service stop || true
    43       else
    44         /etc/init.d/vboxweb-service stop || true
    45       fi
    46     fi
    47     kill -USR1 $VBOXSVC_PID
    48     sleep 1
    49     if pidof VBoxSVC > /dev/null 2>&1; then
    50       db_fset virtualbox/old-running seen false || true
    51       db_input critical virtualbox/old-running || true
    52       db_go || true
    53       exit 1
    54     fi
    55   fi
    56 
    5728  # check for old installation
    5829  if [ -r /etc/vbox/vbox.cfg ]; then
     
    6536    fi
    6637    # we will remove that file in postinst
     38  fi
     39
     40  # check for active VMs
     41  # Execute the installed package's pre-uninstaller if present.
     42  /usr/lib/virtualbox/prerm-common.sh 2>/dev/null || true
     43  # Stop services from older versions without pre-uninstaller.
     44  invoke-rc.d vboxballoonctrl-service stop 2>/dev/null || true
     45  /etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
     46  invoke-rc.d vboxautostart-service stop 2>/dev/null || true
     47  /etc/init.d/vboxautostart-service stop 2>/dev/null || true
     48  invoke-rc.d vboxweb-service stop 2>/dev/null || true
     49  /etc/init.d/vboxweb-service stop 2>/dev/null || true
     50  VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
     51  if [ -n "$VBOXSVC_PID" ]; then
     52    # ask the daemon to terminate immediately
     53    kill -USR1 $VBOXSVC_PID
     54    sleep 1
     55    if pidof VBoxSVC > /dev/null 2>&1; then
     56      db_fset virtualbox/old-running seen false || true
     57      db_input critical virtualbox/old-running || true
     58      db_go || true
     59      exit 1
     60    fi
    6761  fi
    6862
  • trunk/src/VBox/Installer/linux/debian/prerm.in

    r56299 r57888  
    1717#  failed-upgrade:   (our version): failed to upgrade
    1818#  remove:           (our version): remove this package
    19 #  purge:            (our version): purge this package
    2019#  deconfigure:      (our version): removing conflicting version
    2120
     
    2726[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
    2827
    29 if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "failed-upgrade" ]; then
    30   . /usr/share/debconf/confmodule
    31   db_version 2.0
    32   db_capb backup
     28. /usr/share/debconf/confmodule
     29db_version 2.0
     30db_capb backup
    3331
    34   # check for active VMs
    35   VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null`
    36   if [ -n "$VBOXSVC_PID" ]; then
    37     # try graceful termination; terminate the balloon control servic first
    38     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    39       invoke-rc.d vboxballoonctrl-service stop || true
    40     else
    41       /etc/init.d/vboxballoonctrl-service stop || true
    42     fi
    43     # try graceful termination; terminate the webservice first
    44     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    45       invoke-rc.d vboxweb-service stop || true
    46     else
    47       /etc/init.d/vboxweb-service stop || true
    48     fi
    49     kill -USR1 $VBOXSVC_PID
    50     sleep 1
    51     if pidof VBoxSVC > /dev/null 2>&1; then
    52       if [ "$1" != "failed-upgrade" ]; then
    53         db_fset virtualbox/old-running seen false || true
    54         db_input critical virtualbox/old-running || true
    55         db_go || true
    56       fi
    57       exit 1
    58     fi
     32if ! /usr/lib/virtualbox/prerm-common.sh --dkms %VER% > /dev/null 2>&1; then
     33  if [ "$1" != "failed-upgrade" ]; then
     34    db_fset virtualbox/old-running seen false || true
     35    db_input critical virtualbox/old-running || true
     36    db_go || true
    5937  fi
    60 fi
    61 
    62 # make sure we de-register the DMKS modules before the files get removed
    63 if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "deconfigure" ]; then
    64   DKMS=`which dkms 2>/dev/null`
    65   if [ -n "$DKMS" ]; then
    66     $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
    67   fi
    68 fi
    69 
    70 # stop vboxnet/vboxdrv manually as we use our own error handling in postrm
    71 if [ -x "/etc/init.d/vboxdrv" ]; then
    72   if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    73     invoke-rc.d vboxdrv stop || exit $?
    74   else
    75     /etc/init.d/vboxdrv stop || exit $?
    76   fi
    77 fi
    78 if [ -x "/etc/init.d/vboxnet" ]; then
    79   if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
    80     invoke-rc.d vboxnet stop || exit $?
    81   else
    82     /etc/init.d/vboxnet stop || exit $?
    83   fi
     38  exit 1
    8439fi
    8540
  • trunk/src/VBox/Installer/linux/debian/rules

    r57887 r57888  
    242242        mv $(archdir) $(prefix)/usr/lib/$(package)
    243243        ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
    244         mkdir $(prefix)/sbin
    245         ln -s ../etc/init.d/vboxdrv $(prefix)/sbin/rcvboxdrv
    246244        rmdir $(prefix)/opt
    247245        dh_desktop
     
    253251            -e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
    254252            -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
    255             $(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
    256         dh_installinit --name=vboxdrv --noscripts
    257         cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh debian/vboxballoonctrl-service.init
    258         dh_installinit --name=vboxballoonctrl-service --noscripts
    259         cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh debian/vboxautostart-service.init
    260         dh_installinit --name=vboxautostart-service --noscripts
    261         cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh debian/vboxweb-service.init
    262         dh_installinit --name=vboxweb-service --noscripts
     253            $(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > $(prefix)/usr/lib/$(package)/vboxdrv.sh
     254        cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh $(prefix)/usr/lib/$(package)
     255        cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh $(prefix)/usr/lib/$(package)
     256        cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh $(prefix)/usr/lib/$(package)
    263257        sed -e 's|%VER%|$(debver)|g' \
    264258            -e 's|%DATE%|$(shell date -R)|g' \
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette