liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

rc.init (1632B)


      1 #!/bin/sh
      2 
      3 rl="$1"
      4 shift
      5 
      6 ### argv now contains the arguments of the kernel command line that are
      7 ### not of the form key=value. (The key=value arguments were stored by
      8 ### s6-linux-init into an envdir, if instructed so via the -s option.)
      9 ### Normally this argv remains unused because programs that need the
     10 ### kernel command line usually read it later on from /proc/cmdline -
     11 ### but just in case, it's available here.
     12 
     13 
     14 ### 1. Early preparation
     15 ### This is done only once at boot time.
     16 ### Ideally, this phase should just initialize the service manager.
     17 
     18 mount -t proc none /proc
     19 mount -t sysfs none /sys
     20 # s6-linux-init mounts /dev before this script is called
     21 mkdir /dev/pts
     22 mount -t devpts none /dev/pts
     23 
     24 mkdir -m 0751 /run/service-state
     25 chgrp system /run/service-state
     26 
     27 ### If your services are managed by s6-rc:
     28 ### (replace /run/service with your scandir)
     29 s6-rc-init /run/service -d -c /etc/s6-rc/compiled
     30 
     31 
     32 ### 2. Starting the wanted set of services
     33 ### This is also called every time you change runlevels with telinit.
     34 ### (edit the location to suit your installation)
     35 ### By default, $rl is the string "default", unless you changed it
     36 ### via the -D option to s6-linux-init-maker.
     37 ### Numeric arguments from 1 to 5 on the kernel command line will
     38 ### override the default.
     39 
     40 exec /etc/s6-linux-init/current/scripts/runlevel "$rl"
     41 
     42 
     43 ### If this script is run in a container, then 1. and 2. above do not
     44 ### apply and you should just call your CMD, if any, or let your
     45 ### services run.
     46 ### Something like this:
     47 
     48 # if test -z "$*" ; then return 0 ; fi
     49 # $@
     50 # echo $? > /run/s6-linux-init-container-results/exitcode
     51 # halt