#!/bin/sh # System initialization sequence: # # /init # | # +--(1) /etc/01_prepare.sh # | # +--(2) /etc/02_overlay.sh # | # +-- /etc/03_init.sh (this file) # | # +-- /sbin/init # | # +--(1) /etc/04_bootscript.sh # | | # | +-- udhcpc # | | # | +-- /etc/05_rc.udhcp # | # +--(2) /bin/sh (Alt + F1, main console) # | # +--(2) /bin/sh (Alt + F2) # | # +--(2) /bin/sh (Alt + F3) # | # +--(2) /bin/sh (Alt + F4) # If you have persistent overlay support then you can edit this file and replace # the default initialization of the system. For example, you could use this: # # exec setsid cttyhach sh # # This gives you PID 1 shell inside the initramfs area. Since this is a PID 1 # shell, you can still invoke the original initialization logic by executing # this command: # # exec /sbin/init # Print first message on screen. cat /etc/msg/03_init_01.txt # Wait 5 second or until any keybord key is pressed. read -t 5 -n1 -s key if test $key = "" { # Use default initialization logic based on configuration in '/etc/inittab'. echo "Executing /sbin/init as PID 1." exec /sbin/init } else { # Print second message on screen. cat /etc/msg/03_init_02.txt if test $PID1_SHELL = "true" { # PID1_SHELL flag is set which means we have controlling terminal. unset PID1_SHELL exec sh } else { # Interactive shell with controlling tty as PID 1. exec setsid cttyhack sh } } echo "(/etc/03_init.sh) - there is a serious bug..." # Wait until any key has been pressed. read -n1 -s (CommandList children: [ (C {(cat)} {(/etc/msg/03_init_01.txt)}) (C {(read)} {(-t)} {(5)} {(-n1)} {(-s)} {(key)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$key"))} {(Lit_Other "=")} {(DQ )} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(echo)} {(DQ ("Executing /sbin/init as PID 1."))}) (C {(exec)} {(/sbin/init)})] spids: [-1 152] ) ] else_action: [ (C {(cat)} {(/etc/msg/03_init_02.txt)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$PID1_SHELL"))} {(Lit_Other "=")} {(DQ (true))} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(unset)} {(PID1_SHELL)}) (C {(exec)} {(sh)})] spids: [-1 201] ) ] else_action: [(C {(exec)} {(setsid)} {(cttyhack)} {(sh)})] spids: [218 234] ) ] spids: [170 236] ) (C {(echo)} {(DQ ("(/etc/03_init.sh) - there is a serious bug..."))}) (C {(read)} {(-n1)} {(-s)}) ] )