VirtualBox

Changeset 76046 in vbox


Ignore:
Timestamp:
Dec 7, 2018 10:18:49 AM (6 years ago)
Author:
vboxsync
Message:

Linux installers: do not call daemon-restart too often.
bugref:3809: Linux installer maintenance
Some versions of systemd can crash if daemon-restart is called too often, so
only call it once per installation or uninstallation. Do some clean-up of
overly-generic shell script as well.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/installer/install.sh.in

    r75839 r76046  
    471471
    472472# Install, set up and start init scripts
    473 for i in "$INSTALLATION_DIR/init/vboxadd" "$INSTALLATION_DIR/init/vboxadd-service"; do
    474     install_init_script "$i" "`basename "$i"`" 2>> "${LOGFILE}"
    475     addrunlevel "`basename "$i"`" 2>> "${LOGFILE}"
    476     start_init_script "`basename "$i"`" 2>> "${LOGFILE}"
    477 done
     473install_init_script "$INSTALLATION_DIR"/init/vboxadd vboxadd 2>> "$LOGFILE"
     474install_init_script "$INSTALLATION_DIR"/init/vboxadd-service vboxadd-service \
     475    2>> "$LOGFILE"
     476finish_init_script_install
     477addrunlevel vboxadd 2>> "$LOGFILE"
     478addrunlevel vboxadd-service 2>> "$LOGFILE"
     479start_init_script vboxadd 2>> "$LOGFILE"
     480start_init_script vboxadd-service 2>> "$LOGFILE"
    478481
    479482cp $ROUTINES $INSTALLATION_DIR
     
    509512
    510513# Stop and clean up all services
    511 for i in "$INSTALLATION_DIR/init/vboxadd-service" "$INSTALLATION_DIR/init/vboxadd"; do
    512     if test -r "\$i"; then
    513         stop_init_script "\`basename "\$i"\`" 2>> "${LOGFILE}"
    514         test -z "\${NO_CLEANUP}" && grep -q '^# *cleanup_script *$' "\${i}" && "\${i}" cleanup 2>> "\$LOGFILE"
    515         delrunlevel "\`basename "\$i"\`" 2>> "${LOGFILE}"
    516         remove_init_script "\`basename "\$i"\`" 2>> "${LOGFILE}"
    517     fi
    518 done
     514if test -r "$INSTALLATION_DIR"/init/vboxadd-service; then
     515    stop_init_script vboxadd-service 2>> "\$LOGFILE"
     516    delrunlevel vboxadd-service 2>> "\$LOGFILE"
     517    remove_init_script vboxadd-service 2>> "\$LOGFILE"
     518fi
     519if test -r "$INSTALLATION_DIR"/init/vboxadd; then
     520    stop_init_script vboxadd 2>> "\$LOGFILE"
     521    test -n "\$NO_CLEANUP" || "$INSTALLATION_DIR"/init/vboxadd cleanup 2>> "\$LOGFILE"
     522    delrunlevel vboxadd 2>> "\$LOGFILE"
     523    remove_init_script vboxadd 2>> "\$LOGFILE"
     524fi
     525finish_init_script_install
    519526
    520527# Load all modules
  • trunk/src/VBox/Installer/linux/postinst-common.sh

    r69500 r76046  
    5757install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
    5858install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
     59finish_init_script_install
    5960
    6061delrunlevel vboxdrv
  • trunk/src/VBox/Installer/linux/prerm-common.sh

    r69500 r76046  
    6767delrunlevel vboxnet >/dev/null 2>&1
    6868remove_init_script vboxnet >/dev/null 2>&1
     69finish_init_script_install
    6970rm -f /sbin/vboxconfig
    7071exit 0
  • trunk/src/VBox/Installer/linux/routines.sh

    r72196 r76046  
    173173WantedBy=multi-user.target
    174174EOF
    175     systemctl daemon-reexec
    176 }
    177 
    178 ## Installs a file containing a shell script as an init script
     175}
     176
     177use_systemd()
     178{
     179    test ! -f /sbin/init || test -L /sbin/init
     180}
     181
     182## Installs a file containing a shell script as an init script.  Call
     183# finish_init_script_install when all scripts have been installed.
    179184install_init_script()
    180185{
     
    191196    ln -s "${script}" "/sbin/rc${name}"
    192197    if test -x "`which systemctl 2>/dev/null`"; then
    193         if ! test -f /sbin/init || ls -l /sbin/init | grep -q ">.*systemd"; then
     198        if use_systemd; then
    194199            { systemd_wrap_init_script "$script" "$name"; return; }
    195200        fi
     
    219224    rm -f "/etc/rc.d/init.d/$name"
    220225    rm -f "/etc/init.d/$name"
     226}
     227
     228## Tell systemd services have been installed or removed.  Should not be done
     229# after each individual one, as systemd can crash if it is done too often
     230# (reported by the OL team for OL 7.6, may not apply to other versions.)
     231finish_init_script_install()
     232{
     233    if use_systemd; then
     234        systemctl daemon-reexec
     235    fi
    221236}
    222237
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