Update lfs-uefi.txt
[linux_from_scratch_hints.git] / ATTACHMENTS / build-with-runit / build-with-runit-scripts.txt
blobf9e64461d487be6c601e4ff2b3c312abcd31b4ba
1 #!/bin/bash
3 #-----------------------------------------------------------------
4 # Submitted BY: Richard Downing <geek109 at hotmail dot com>
6 # Date: 2004-05-04
8 # Script Version: 1.1 (Changelog at end of file)
10 # Initial Package Version: applies to the Building LFS with runit
11 # version of 2004-03-29.
13 # Upstream Status: Not applicable.
15 # Origin: Richard Downing.
17 # Description: Execute to create required runit scripts. See Hint.
19 #------------------------------------------------------------------
23 mkdir /etc/runit
25 cat > /etc/runit/1 << "EOF"
26 #!/bin/sh
27 # System one time tasks
28 # The Stage 1 script for runit.
30 PATH=/sbin:/bin:/usr/sbin:/usr/bin
32 # mount the swap partition
33 /etc/rc.d/init.d/swap start
35 # mount the /proc pseudo-partition
36 # N.B. ---------- Change to mountkernfs for LFS-Bootscripts-2.x
37 /etc/rc.d/init.d/mountproc start
39 # run the fsck checks
40 /etc/rc.d/init.d/checkfs start
42 # remount root rw,
43 # and mount all other non-proc auto partitions
44 /etc/rc.d/init.d/mountfs start
46 # clean up after the last boot session by
47 # removing stale /var/run and /var/lock files
48 # and setting up utmp etc.
49 /etc/rc.d/init.d/cleanfs
51 # Initialise the random number generator
52 /etc/rc.d/init.d/random start
54 # Set the system clock from the rtc
55 /etc/rc.d/init.d/setclock start
57 # Load the keymap file
58 /etc/rc.d/init.d/loadkeys
60 # Bring up the local loopback network
61 /etc/rc.d/init.d/localnet start
63 # Bring up the NICs and network
64 # and set up the default gateway
65 /etc/rc.d/init.d/network start
67 touch /etc/runit/stopit
68 chmod 0 /etc/runit/stopit
69 EOF
71 chmod +x /etc/runit/1
74 cat > /etc/runit/2 << "EOF"
75 #!/bin/sh
77 PATH=/bin:/sbin:/usr/bin:/usr/sbin
79 exec env - PATH=$PATH \
80 runsvdir /var/service 'log: ............................................................
81 ........................................................................................
82 ........................................................................................
83 ........................................................................................
84 .......................................................................'
85 EOF
87 chmod +x /etc/runit/2
90 cat > /etc/runit/3 << "EOF"
91 #!/bin/sh
92 exec 2>&1
94 PATH=/sbin:/bin:/usr/sbin:/usr/bin
96 LAST=0
97 test -x /etc/runit/reboot && LAST=6
99 echo 'Waiting for getties to stop...'
100 svwaitdown -xk -t10 /var/service/getty-*
102 echo 'Waiting for services to stop...'
103 svwaitdown -xk -t30 /var/service/*
105 # save the random number generator seed
106 /etc/rc.d/init.d/random stop
108 # turn swapping off
109 /etc/rc.d/init.d/swap stop
111 # Bring down the network
112 # and remove the default gateway
113 /etc/rc.d/init.d/network stop
115 # Bring down the localnet
116 /etc/rc.d/init.d/localnet stop
120 chmod +x /etc/runit/3
122 cat > /etc/runit/ctrlaltdel << "EOF"
123 #!/bin/sh
125 PATH=/bin:/usr/bin
126 MSG="System is going down in 14 seconds..."
128 # echo 'disabled.' ; exit
129 touch /etc/runit/stopit
130 chmod 100 /etc/runit/stopit && echo "$MSG" | wall
131 /bin/sleep 14
134 chmod +x /etc/runit/ctrlaltdel
136 for N in 1 2 3 4 5 6
138 mkdir -p /etc/runit/getty-$N
139 echo "#!/bin/bash" > /etc/runit/getty-$N/run
140 echo "exec /sbin/agetty 38400 tty$N linux" >> /etc/runit/getty-$N/run
141 echo "#!/bin/bash" > /etc/runit/getty-$N/finish
142 echo "exec utmpset -w tty$N" >> /etc/runit/getty-$N/finish
143 chmod +x /etc/runit/getty-$N/*
144 mkdir -p /var/service
145 ln -s /etc/runit/getty-$N /var/service
146 done
148 #------------------------------------------------------------------#
149 # Changelog: #
150 # 2004-03-29 V1.0 First release. #
151 # 2004-04-05 V1.1 Fixed Getty creation script. #
152 # added N.B. for lfs-bootscripts-2.x.x #
153 #------------------------------------------------------------------#