VirtualBox

Changeset 58216 in vbox


Ignore:
Timestamp:
Oct 13, 2015 2:47:03 PM (9 years ago)
Author:
vboxsync
Message:

Installers/linux: detect Debian systems with systemd installed but not in use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/routines.sh

    r58186 r58216  
    166166    test -L "/sbin/rc${name}" && rm "/sbin/rc${name}"
    167167    ln -s "${script}" "/sbin/rc${name}"
    168     test -x "`which systemctl 2>/dev/null`" &&
    169         { systemd_wrap_init_script "$script" "$name"; return; }
     168    if test -x "`which systemctl 2>/dev/null`"; then
     169        if ! test -L /sbin/init || ls -l /sbin/init | grep -q systemd; then
     170            { systemd_wrap_init_script "$script" "$name"; return; }
     171        fi
     172    fi
    170173    if test -d /etc/rc.d/init.d; then
    171174        cp "${script}" "/etc/rc.d/init.d/${name}" &&
     
    194197}
    195198
     199## Did we install a systemd service?
     200systemd_service_installed()
     201{
     202    ## Name of service to test.
     203    name="${1}"
     204
     205    test -f /lib/systemd/system/"${name}".service ||
     206        test -f /usr/lib/systemd/system/"${name}".service
     207}
     208
    196209## Perform an action on a service
    197210do_sysvinit_action()
     
    205218    test ! -z "${name}" && test ! -z "${action}" ||
    206219        { echo "${self}: missing argument" >&2; return 1; }
    207     if test -x "`which systemctl 2>/dev/null`"; then
     220    if systemd_service_installed "${name}"; then
    208221        systemctl -q ${action} "${name}"
    209222    elif test -x "`which service 2>/dev/null`"; then
     
    266279    test -n "${name}" || \
    267280        { echo "${self}: missing argument" >&2; return 1; }
    268     test -x "`which systemctl 2>/dev/null`" && \
     281    systemd_service_installed "${name}" && \
    269282        { systemctl -q enable "${name}"; return; }
    270283    if test -x "/etc/rc.d/init.d/${name}"; then
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