1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
#!/bin/sh
#
# /etc/rc.sysinit
#
. /etc/rc.conf
. /etc/rc.d/functions
echo " "
printhl "Arch Linux v0.7.1 $C_OTHER(${C_H2}Noodle$C_OTHER)\n"
printhl "${C_H2}http://www.archlinux.org"
printhl "Copyright 2002-2006 Judd Vinet"
printhl "Distributed under the GNU General Public License (GPL)"
printsep
# start up our mini logger until syslog takes over
/sbin/minilogd
# anything more serious than KERN_WARNING goes to the console
/bin/dmesg -n 3
# mount /proc and /sys
mount -n -t proc none /proc
[ "`grep sysfs /proc/filesystems`" ] && mount -n -t sysfs none /sys
if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
# Looks like devfs is running, use it
status "Starting DevFS Daemon" /sbin/devfsd /dev
elif [ -x /etc/start_udev -a -d /sys/block ]; then
# We have a start_udev script and /sys appears to be mounted, use UDev
status "Starting UDev Daemon" /etc/start_udev
else
# Static /dev, our last resort
status "Using static /dev filesystem" /bin/true
fi
# If using an encrypted root fs, we should find the root dev in the initrd
if [ -e /initrd/dev/mapper/root ]; then
mkdir /dev/mapper 2>/dev/null
cp -a /initrd/dev/mapper/root /dev/mapper/root
fi
# If necessary, find md devices and manually assemble RAID arrays
if [ -f /etc/mdadm.conf -a "`grep ^ARRAY /etc/mdadm.conf 2>/dev/null`" ]; then
if [ -d /initrd/dev ]; then
# udev won't create these md nodes, so we steal them from the initrd
for i in `grep ^ARRAY /etc/mdadm.conf | awk '{print $2}'`; do
cp -a /initrd/$i /dev/
done
fi
status "Assembling RAID arrays" /sbin/mdadm --assemble --scan
fi
# Unmount and free up the old initrd if it exists
if [ -f /initrd/linuxrc ]; then
stat_busy "Freeing memory from Initial Ramdisk"
umount /initrd 2>/dev/null
/sbin/blockdev --flushbufs /dev/rd/0 2>/dev/null
stat_done
fi
# TODO: set up non-root encrypted partition mappings
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
if [ -f /etc/lvmtab -a -x /sbin/vgchange ]; then
# Kernel 2.4.x, LVM1 groups
stat_busy "Activating LVM1 groups"
/sbin/vgchange -a y
stat_done
elif [ -x /sbin/lvm -a -d /sys/block ]; then
# Kernel 2.6.x, LVM2 groups
stat_busy "Activating LVM2 groups"
/sbin/lvm vgscan --ignorelockingfailure
/sbin/lvm vgchange --ignorelockingfailure -a y
stat_done
fi
fi
status "Activating Swap" /sbin/swapon -a
status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
if [ -x /sbin/fsck ]; then
stat_busy "Checking Filesystems"
/sbin/fsck -A -T -C -a $FORCEFSCK
if [ $? -gt 1 ]; then
stat_fail
echo
echo "***************** FILESYSTEM CHECK FAILED ****************"
echo "* *"
echo "* Please repair manually and reboot. Note that the root *"
echo "* file system is currently mounted read-only. To remount *"
echo "* it read-write type: mount -n -o remount,rw / *"
echo "* When you exit the maintenance shell the system will *"
echo "* reboot automatically. *"
echo "* *"
echo "************************************************************"
echo
/sbin/sulogin -p
echo "Automatic reboot in progress..."
/bin/umount -a
/bin/mount -n -o remount,ro /
/sbin/reboot -f
exit 0
fi
stat_done
fi
stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
/bin/rm -f /etc/mtab*
# make sure / gets written to /etc/mtab
/bin/mount -o remount,rw /
# re-mount /proc and /sys so they can be written to /etc/mtab
umount /proc && mount -t proc none /proc
[ "`grep sysfs /proc/filesystems`" ] && umount /sys && mount -t sysfs none /sys
# now mount all the local filesystems
/bin/mount -a -t nonfs,nosmbfs,nocifs,noncpfs,nosysfs,nousbfs
stat_done
status "Detecting Required Modules" /sbin/hwdetect -load-modules
stat_busy "Configuring System Clock"
if [ "$HARDWARECLOCK" = "UTC" ]; then
/sbin/hwclock --utc --hctosys
else
/sbin/hwclock --localtime --hctosys
fi
if [ ! -f /var/lib/hwclock/adjtime ]; then
echo "0.0 0 0.0" > /var/lib/hwclock/adjtime
fi
if [ "$TIMEZONE" != "" ]; then
/bin/ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi
stat_done
stat_busy "Removing Leftover Files"
/bin/rm -f /etc/nologin &>/dev/null
/bin/rm -f /etc/shutdownpid &>/dev/null
/bin/rm -f /var/lock/* &>/dev/null
/bin/rm -f /var/run/*.pid &>/dev/null
/bin/rm -f /var/run/daemons/* &>/dev/null
/bin/rm -f /var/run/net/* &>/dev/null
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
/bin/rm -f /forcefsck &>/dev/null
: > /var/run/utmp
# Keep {x,k,g}dm happy with xorg
mkdir /tmp/.ICE-unix && chmod 1777 /tmp/.ICE-unix
mkdir /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
stat_done
#status "Updating Shared Library Links" /sbin/ldconfig
if [ "$HOSTNAME" != "" ]; then
status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME
fi
# Set the NIS domain name, if necessary
[ -f /etc/conf.d/nisdomainname ] && . /etc/conf.d/nisdomainname
if [ "$NISDOMAINNAME" != "" ]; then
status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname $NISDOMAINNAME
fi
status "Updating Module Dependencies" /sbin/depmod -A
if [ -f /var/run/random-seed ]; then
stat_busy "Initializing Random Seed"
/bin/cat /var/run/random-seed >/dev/urandom
stat_done
fi
if [ "$KEYMAP" != "" ]; then
status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
fi
# Set user defined locale
if [ "$LOCALE" != "" ]; then
stat_busy "Setting Locale: $LOCALE"
echo "export LANG=$LOCALE" >/etc/profile.d/locale.sh
/bin/chmod 755 /etc/profile.d/locale.sh
# If locale is *.utf set console to Unicode mode
if [ "`echo $LOCALE | /bin/grep -i utf`" != "" ]; then
/usr/bin/kbd_mode -u
/usr/bin/dumpkeys | /bin/loadkeys --unicode
echo 'for i in `seq 1 12`; do' >>/etc/profile.d/locale.sh
echo ' echo -ne "\033%G"' >>/etc/profile.d/locale.sh
echo 'done' >>/etc/profile.d/locale.sh
if [ "$CONSOLEFONT" = "" ]; then
CONSOLEFONT="LatArCyrHeb-16"
fi
fi
stat_done
else
rm -f /etc/profile.d/locale.sh
fi
if [ "$CONSOLEFONT" != "" ]; then
stat_busy "Loading Console Font: $CONSOLEFONT"
for i in `seq 1 12`; do
if [ "$CONSOLEMAP" != "" ]; then
/usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C /dev/vc/${i};
else
/usr/bin/setfont $CONSOLEFONT -C /dev/vc/${i};
fi
done
stat_done
fi
# Load USB support
/sbin/modprobe usbcore >/dev/null 2>&1
[ "`grep usbfs /proc/filesystems`" ] && mount -t usbfs none /proc/bus/usb
# Load modules from the MODULES array defined in rc.conf
if [ -f /proc/modules ]; then
stat_busy "Loading Modules"
for mod in "${MODULES[@]}"; do
if [[ `echo $mod | grep '^[^\!]' | wc -l` -eq 1 ]]; then
/sbin/modprobe $mod
fi
done
stat_done
fi
# Screen blanks after 15 minutes idle time
/usr/bin/setterm -blank 15
# End of file
# vim: set ts=2 noet:
|