rc.init (1851B)
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 mount -t tmpfs none /tmp 21 # s6-linux-init mounts /dev before this script is called 22 mkdir /dev/pts 23 mount -t devpts none /dev/pts 24 25 mkdir -m 0751 -p /run/services/outputs 26 chgrp system /run/services/outputs 27 28 if test -d /persist; then 29 mkdir -m 0751 -p /persist/services/state 30 (cd /run/services && ln -s ../../persist/services/state .) 31 else 32 mkdir -m 0751 -p /run/services/state 33 fi 34 35 ### If your services are managed by s6-rc: 36 ### (replace /run/service with your scandir) 37 s6-rc-init /run/service -d -c /etc/s6-rc/compiled 38 39 40 ### 2. Starting the wanted set of services 41 ### This is also called every time you change runlevels with telinit. 42 ### (edit the location to suit your installation) 43 ### By default, $rl is the string "default", unless you changed it 44 ### via the -D option to s6-linux-init-maker. 45 ### Numeric arguments from 1 to 5 on the kernel command line will 46 ### override the default. 47 48 exec /etc/s6-linux-init/current/scripts/runlevel "$rl" 49 50 51 ### If this script is run in a container, then 1. and 2. above do not 52 ### apply and you should just call your CMD, if any, or let your 53 ### services run. 54 ### Something like this: 55 56 # if test -z "$*" ; then return 0 ; fi 57 # $@ 58 # echo $? > /run/s6-linux-init-container-results/exitcode 59 # halt