Mercurial > vanilla
comparison core/rc/rc.init @ 575:3c0d8d9fe11e
core/rc: simplify rc.init
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 08 Jul 2019 20:16:00 +0200 |
parents | 290ca0287e5d |
children | dbd752e285f6 |
comparison
equal
deleted
inserted
replaced
574:789137658fdb | 575:3c0d8d9fe11e |
---|---|
23 | 23 |
24 if [ "${BANNER:-yes}" = "yes" ]; then | 24 if [ "${BANNER:-yes}" = "yes" ]; then |
25 printf "\nWelcome to \033[33;1mVanilla Linux\033[0m\n\n" | 25 printf "\nWelcome to \033[33;1mVanilla Linux\033[0m\n\n" |
26 fi | 26 fi |
27 | 27 |
28 if [ -n "$HOSTNAME" ] && [ -x /bin/hostname ]; then | 28 if [ -n "$HOSTNAME" ]; then |
29 echo "Setting hostname: $HOSTNAME" | 29 echo "Setting hostname: $HOSTNAME" |
30 /bin/hostname "$HOSTNAME" | 30 /bin/hostname "$HOSTNAME" |
31 fi | 31 fi |
32 | 32 |
33 if [ -x /bin/sysctl ]; then | 33 echo "Setting kernel parameters" |
34 echo "Setting kernel parameters" | 34 /bin/sysctl -p >/dev/null 2>&1 |
35 /bin/sysctl -p >/dev/null 2>&1 | 35 |
36 echo -n "Mounting filesystems: " | |
37 | |
38 if ! /bin/mountpoint /dev >/dev/null 2>&1; then | |
39 /bin/mount -t devtmpfs devtmpfs /dev >/dev/null 2>&1 | |
40 echo -n "/dev " | |
36 fi | 41 fi |
37 | 42 |
38 if [ -x /bin/mountpoint ]; then | 43 if ! /bin/mountpoint /proc >/dev/null 2>&1; then |
39 echo -n "Mounting filesystems: " | 44 /bin/mount -t proc proc /proc >/dev/null 2>&1 |
45 echo -n "/proc " | |
46 fi | |
40 | 47 |
41 if ! /bin/mountpoint /dev >/dev/null 2>&1; then | 48 if ! /bin/mountpoint /sys >/dev/null 2>&1; then |
42 /bin/mount -t devtmpfs devtmpfs /dev >/dev/null 2>&1 | 49 /bin/mount -t sysfs sysfs /sys >/dev/null 2>&1 |
43 echo -n "/dev " | 50 echo -n "/sys " |
44 fi | 51 fi |
45 | 52 |
46 if ! /bin/mountpoint /proc >/dev/null 2>&1; then | 53 if ! /bin/mountpoint /run >/dev/null 2>&1; then |
47 /bin/mount -t proc proc /proc >/dev/null 2>&1 | 54 /bin/mount -t tmpfs tmpfs /run >/dev/null 2>&1 |
48 echo -n "/proc " | 55 echo -n "/run " |
49 fi | 56 fi |
50 | 57 |
51 if ! /bin/mountpoint /sys >/dev/null 2>&1; then | 58 echo "done" |
52 /bin/mount -t sysfs sysfs /sys >/dev/null 2>&1 | |
53 echo -n "/sys " | |
54 fi | |
55 | |
56 if ! /bin/mountpoint /run >/dev/null 2>&1; then | |
57 /bin/mount -t tmpfs tmpfs /run >/dev/null 2>&1 | |
58 echo -n "/run " | |
59 fi | |
60 | |
61 echo "done." | |
62 fi | |
63 | 59 |
64 # Clean pid files before starting any services. | 60 # Clean pid files before starting any services. |
65 find /var/run -type f -name "*.pid" -delete | 61 find /var/run -type f -name "*.pid" -delete |
66 | 62 |
67 # | 63 # |
77 /etc/rc.d/udevd start | 73 /etc/rc.d/udevd start |
78 elif [ -x /etc/rc.d/busybox.mdev ]; then | 74 elif [ -x /etc/rc.d/busybox.mdev ]; then |
79 /etc/rc.d/busybox.mdev start | 75 /etc/rc.d/busybox.mdev start |
80 fi | 76 fi |
81 | 77 |
82 if [ -x /bin/fsck ]; then | 78 # Make sure / is ro in case of initrd. |
83 # Make sure / is ro in case of initrd. | 79 /bin/mount -o remount,ro / |
84 /bin/mount -o remount,ro / | |
85 | 80 |
86 # If /etc/forcefsck is there, force check. | 81 # If /etc/forcefsck is there, force check. |
87 if [ -f /etc/forcefsck ]; then | 82 if [ -f /etc/forcefsck ]; then |
88 force="-f" | 83 force="-f" |
89 fi | 84 fi |
90 | 85 |
91 /bin/fsck $force -A -T -C -a >/dev/null 2>&1 | 86 /bin/fsck $force -A -T -C -a >/dev/null 2>&1 |
92 | 87 |
93 if [ "$?" -gt 1 ]; then | 88 if [ "$?" -gt 1 ]; then |
94 echo "* Filesystem check failed" | 89 echo "* Filesystem check failed" |
95 /bin/sulogin -p | 90 /bin/sulogin -p |
96 fi | 91 /bin/reboot |
97 fi | 92 fi |
98 | 93 |
99 # Remount / and enable swap as the system is ready. | 94 # Remount / and enable swap as the system is ready. |
100 /bin/mount -o remount,rw / | 95 /bin/mount -o remount,rw / |
101 /bin/swapon -a | 96 /bin/swapon -a |
102 | 97 |
103 # Update shared library caches. | 98 # Update shared library caches. |
104 if [ -x /bin/ldconfig ]; then | 99 /bin/ldconfig |
105 /bin/ldconfig | |
106 fi | |
107 | 100 |
108 if [ -n "$TIMEZONE" ] && [ "$TIMEZONE" != "UTC" ]; then | 101 if [ -n "$TIMEZONE" ] && [ "$TIMEZONE" != "UTC" ]; then |
109 echo -n "Setting timezone: " | 102 echo -n "Setting timezone: " |
110 | 103 |
111 if [ -f /share/zoneinfo/$TIMEZONE ]; then | 104 if [ -f /share/zoneinfo/$TIMEZONE ]; then |
115 echo "$TIMEZONE not found" | 108 echo "$TIMEZONE not found" |
116 fi | 109 fi |
117 fi | 110 fi |
118 | 111 |
119 # Console font and keymap. | 112 # Console font and keymap. |
120 if [ -n "$FONT" ] && [ -x /bin/setfont ]; then | 113 if [ -n "$FONT" ]; then |
121 echo "Setting font: $FONT" | 114 echo "Setting font: $FONT" |
122 /bin/setfont $FONT | 115 /bin/setfont $FONT |
123 fi | 116 fi |
124 | 117 |
125 if [ -n "$KEYMAP" ] && [ -x /bin/loadkeys ]; then | 118 if [ -n "$KEYMAP" ]; then |
126 echo "Setting keymap: $KEYMAP" | 119 echo "Setting keymap: $KEYMAP" |
127 /bin/loadkeys $KEYMAP | 120 /bin/loadkeys $KEYMAP |
128 fi | 121 fi |
129 | 122 |
130 # Cleanup some files. | 123 # Cleanup some files. |