fbs view examples/rcS.minimal @ rev 8
Remove ashism ==
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Feb 26 12:27:47 2019 +0100 (2019-02-26) |
parents | cbddf8e3069d |
children |
line source
1 #!/bin/sh
2 #
3 # /etc/init.d/rcS : Initial boot script for SliTaz
4 # Config file is : /etc/rcS.conf
5 #
6 # rcS is the main initialization script used to check fs, mount, clean,
7 # run scripts and start daemons. This is a custom script for ARM to get
8 # a faster boot and skip things like handling cdrom.
9 #
10 # Copyright (C) 2012-2014 SliTaz - BSD License
11 #
12 . /lib/libtaz.sh
13 . /etc/rcS.conf
14 . /etc/fbs.conf
16 # Set default path
17 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
19 # Framebuffer Boot Splash
20 if [ "$FBSPLASH" = "on" ]; then
21 clear && usleep 250000
22 fifo="/fbs.fifo" && fbs start
23 echo "0" > ${fifo} && usleep 500000
24 fi
26 echo $(colorize 34 "Processing: /etc/init.d/rcS")
28 # Mount all from: /etc/fstab
29 echo "Mounting filesystems in fstab..."
30 mkdir -p /dev/pts /dev/shm
31 mount -a
33 [ "$fifo" ] && echo "10" > ${fifo} && usleep 500000
35 # Mount /run as tmpfs so runtime data are not written to disk
36 echo "Mounting tmpfs filesystem on: /run"
37 mount -t tmpfs tmpfs /run
38 mount --bind /run /var/run
40 # Store boot messages to log files
41 log="/var/log/boot.log"
42 dmesg > /var/log/dmesg.log &
44 # Be quiet at boot
45 echo "0 0 0 0" > /proc/sys/kernel/printk
47 [ "$fifo" ] && echo "20" > ${fifo}
49 # Use udev and disable hotplug helper (udevd listen to netlink)
50 if [ -x "/sbin/udevd" ]; then
51 echo "" > /proc/sys/kernel/hotplug
52 echo "Starting udev daemon..."
53 udevd --daemon 2>/dev/null
54 udevadm trigger
55 udevadm settle --timeout=120
56 else
57 # Fallback to Busybox mdev
58 echo -n "Creating device nodes: /sbin/mdev -s"
59 echo "/sbin/mdev" > /proc/sys/kernel/hotplug
60 mdev -s; status
61 fi
63 [ "$fifo" ] && echo "30" > ${fifo}
65 # Clean up /tmp
66 echo -n "Cleaning up temporary files: /tmp"
67 rm -rf /tmp && mkdir /tmp && chmod 1777 /tmp
68 status
70 [ "$fifo" ] && echo "40" > ${fifo}
72 # Start syslogd and klogd
73 echo -n "Starting system log daemons: syslogd/klogd..."
74 syslogd -s ${SYSLOGD_SIZE} && klogd
75 status
77 [ "$fifo" ] && echo "50" > ${fifo}
79 # Load all modules from config file
80 if [ "$LOAD_MODULES" ]; then
81 colorize 33 "Loading Kernel modules..."
82 for mod in ${LOAD_MODULES}; do
83 modprobe -v $mod | tee -a ${log}
84 done
85 fi
87 [ "$fifo" ] && echo "60" > ${fifo}
89 # Start all init scripts
90 for script in ${RUN_SCRIPTS}; do
91 colorize 34 "Processing: /etc/init.d/$script"
92 /etc/init.d/$script | tee -a ${log}
93 done
95 [ "$fifo" ] && echo "70" > ${fifo}
97 # Start all daemons
98 if [ "$RUN_DAEMONS" ]; then
99 colorize 33 "Starting all daemons..."
100 for daemon in ${RUN_DAEMONS}; do
101 /etc/init.d/$daemon start
102 done
103 fi
105 [ "$fifo" ] && echo "80" > ${fifo}
107 # Start X session
108 if [ -x "/etc/init.d/$LOGIN_MANAGER" ]; then
109 colorize 36 "Starting X environment..."
110 /etc/init.d/$LOGIN_MANAGER start >/dev/null &
111 fi
113 [ "$fifo" ] && echo "90" > ${fifo}
115 newline
116 colorize 32 "$MESSAGE"
118 # Exit fbs
119 if [ "$fifo" ]; then
120 echo "100" > ${fifo} && sleep 1
121 sleep 1 && echo "exit" > ${fifo} && rm -f ${fifo}
122 fi
124 # Back to a verbose mode but wait to finish with a clean boot
125 (sleep 4; echo "7 4 1 7" > /proc/sys/kernel/printk) &