]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - config/install/rc
Wrote nice initscripts for the installer.
[people/ms/ipfire-3.x.git] / config / install / rc
1 #!/bin/ash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 ## Set the defaults
23 STARTUP_MODE=install
24 HOSTNAME=ipfire.localdomain
25
26 . /etc/functions
27
28 boot_mesg -n "Mounting kernel-based file systems:" ${INFO}
29
30 boot_mesg -n " /proc" ${NORMAL}
31 mount -n -t proc proc /proc || failed=1
32
33 boot_mesg -n " /sys" ${NORMAL}
34 mount -n -t sysfs sysfs /sys || failed=1
35
36 boot_mesg "" ${NORMAL}
37
38 (exit ${failed})
39 evaluate_retval
40
41
42 boot_mesg "Silencing kernel..."
43 echo >/proc/sys/kernel/printk "1 4 1 7"
44 evaluate_retval
45
46
47 boot_mesg "Disabling screen blanking..."
48 echo -n -e "\033[9;0]"
49 evaluate_retval
50
51
52 boot_mesg "Mounting /dev"
53 mount -n -t tmpfs tmpfs /dev -o mode=755
54 evaluate_retval
55
56 boot_mesg "Populating /dev with device nodes..."
57 echo > /proc/sys/kernel/hotplug
58
59 cp -a /lib/udev/devices/* /dev
60 /sbin/udevd --daemon
61 /sbin/udevtrigger
62 /sbin/udevsettle
63 evaluate_retval
64
65
66 boot_mesg "Bringing up the loopback interface..."
67 ip addr add 127.0.0.1/8 label lo dev lo
68 ip link set lo up
69 evaluate_retval
70
71
72 boot_mesg "Setting hostname to ${HOSTNAME}..."
73 hostname ${HOSTNAME}
74 evaluate_retval
75
76
77 # Now check what mode= was passed to the kernel
78 for i in $(cat /proc/cmdline); do
79 case $i in
80 mode=*)
81 STARTUP_MODE=${i#mode=}
82 ;;
83 esac
84 done
85
86 case $STARTUP_MODE in
87 install)
88 SYSLOGD_EXTRA="-O /root/install.log"
89
90 boot_mesg "Detecting hardware..."
91 for MODULE in $(kudzu -qps -t 30 | grep driver: | cut -d ' ' -f 2 | sort | uniq); do
92 if [ "$MODULE" = "unknown" ] || \
93 [ "$MODULE" = "ignore" ] || \
94 [ "$MODULE" = "" ]; then
95 continue
96 fi
97 MODULE=$(find /lib/modules -name $(echo $MODULE | sed -e 's/[_-]/*/g')* 2>/dev/null)
98 [ "$MODULE" == "" ] && continue
99 MODULE=$(basename $MODULE | cut -d. -f1 | head -1)
100
101 if grep -Eqe "^$MODULE " /proc/modules; then
102 continue
103 fi
104
105 echo "$MODULE" >> /tmp/modules-found.txt
106 modprobe $MODULE
107
108 done
109 echo_ok
110 ;;
111 rescue)
112 sed -i "s, -c /bin/installer,,g" /etc/inittab
113 ;;
114 esac
115
116
117 boot_mesg "Starting system log daemon..."
118 syslogd -O /dev/tty4 $SYSLOGD_EXTRA
119 evaluate_retval
120
121
122 exec init
123