Enjoy Slackware 15.0!

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
talk:howtos:general_admin:openrc [2015/05/18 17:54 (UTC)]
aaditya sorry for not noticing question before
talk:howtos:general_admin:openrc [2018/11/06 19:35 (UTC)]
aaditya add section for migration to openrc 0.39+
Line 22: Line 22:
  
  --- //[[wiki:user:aaditya|Aaditya Bagga]] 2015/05/18 10:50//  --- //[[wiki:user:aaditya|Aaditya Bagga]] 2015/05/18 10:50//
 +
 +=== Migrating to OpenRC 0.39+ from previous versions ===
 +
 +OpenRC 0.39, as shipped via [[https://slackbuilds.org/|SBo]], features 2 main changes:
 +
 +  * **openrc-init** is being used as init instead of ///sbin/init//
 +  * Service and configuration directory has been changed to ///etc/openrc// instead of ///etc//
 +
 +Both these changes were done to have a clean{er} OpenRC install which can co-exist with other init systems like sysvinit (default), runit, etc, just by changing a boot parameter.
 +
 +To change from ///etc/init.d// to ///etc/openrc/init.d//:
 +
 +  # migrate existing services
 +  for service in /etc/init.d/*; do
 +    svcname=$(basename "$service")
 +    if [ ! -e "/etc/openrc/init.d/${svcname}" ]; then
 +      if [ -f "/etc/init.d/${svcname}" ] && grep -q openrc "/etc/init.d/${svcname}"; then
 +        cp -v "/etc/init.d/${svcname}" "/etc/openrc/init.d/${svcname}"
 +      elif [ -L "/etc/init.d/${svcname}" ]; then
 +        # check if symlink is of a service
 +        service_target=$(readlink -f "$service")
 +        service_target_name=$(basename "$service_target")
 +        if [ $(dirname "$service_target") = "/etc/init.d" ]; then
 +          ln -sv "/etc/openrc/init.d/${service_target_name}" "/etc/openrc/init.d/${svcname}"
 +        fi
 +      fi
 +    fi
 +  done
 +  
 +  # enable existing services
 +  for runlevel in /etc/runlevels/*; do
 +    for service in ${runlevel}/*; do
 +      svcname=$(basename "$service")
 +      rvlname=$(basename "$runlevel")
 +      if [ ! -e /etc/openrc/runlevels/${rvlname}/${svcname} ] && [ -e /etc/openrc/init.d/${svcname} ]; then
 +        ln -sv /etc/openrc/init.d/${svcname} /etc/openrc/runlevels/${rvlname}/${svcname}
 +      fi
 +    done
 +  done
 +  
 +  # check config changes
 +  for file in /etc/conf.d/*; do
 +    filename=$(basename "$file")
 +    extension="${filename##*.}"
 +    if [ "$extension" = orig ] || [ "$extension" == new ]; then
 +      continue  # dont need to check extra
 +    fi
 +    if [ -e "/etc/conf.d/${filename}" ] && [ -e "/etc/openrc/conf.d/${filename}" ]; then
 +      diff -Nupr "/etc/conf.d/${filename}" "/etc/openrc/conf.d/${filename}"
 +    fi
 +  done
 +
 +Config changes found above can be updated by hand or copy pasted in new location.
 +
 +After checking that things are working expected, old files and folders can be renamed (or removed).
 +
 +  mv /etc/init.d /etc/init.d-openrc-bkp
 +  mv /etc/conf.d /etc/conf.d-openrc-bkp
 +  mv /etc/rc.conf /etc/rc.conf-openrc.bkp
 +  mv /etc/inittab /etc/inittab-openrc.bkp
 +
 +Finally initial changes done by us can be reverted:
 +
 +  mv /etc/init.d-bkp /etc/init.d
 +  mv /etc/inittab.sysvinit /etc/inittab

In Other Languages
QR Code
QR Code talk:howtos:general_admin:openrc (generated for current page)