]> git.pld-linux.org Git - projects/rc-scripts.git/blob - rc.d/rc.sysinit
- usb, quota, pnp kernel and other changes/fixes
[projects/rc-scripts.git] / rc.d / rc.sysinit
1 #!/bin/sh
2 #
3 # /etc/rc.d/rc.sysinit - run once at boot time
4 # $Id: rc.sysinit,v 1.69.2.10 2001/07/05 21:07:14 misiek Exp $
5 #
6 # Taken in part from Miquel van Smoorenburg's bcheckrc.
7 # Changes:      Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
8 #
9
10 # Rerun ourselves through initlog
11 if [ -z "$IN_INITLOG" ]; then
12         [ -f /sbin/initlog ] && exec /sbin/initlog -r /etc/rc.d/rc.sysinit
13 fi
14  
15 # Set the path
16 PATH=/bin:/sbin:/usr/bin:/usr/sbin
17 export PATH
18
19 # NLS
20 if [ -r /etc/sysconfig/i18n ]; then
21         . /etc/sysconfig/i18n
22         [ -n "$LANG" ] && export LANG || unset LANG
23         [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
24         [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
25         [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
26         [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
27         [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
28         [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
29         [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
30         [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
31         [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
32 fi
33
34 # Read functions
35 . /etc/rc.d/init.d/functions
36
37 # Read network config data.
38 if [ -r /etc/sysconfig/network ]; then
39         . /etc/sysconfig/network
40 else
41         NETWORKING=no
42         HOSTNAME=localhost
43 fi
44
45 # Read system config data.
46 if [ -r /etc/sysconfig/system ]; then
47         . /etc/sysconfig/system
48 else
49         RUN_SULOGIN_ON_ERR=yes
50         RUN_ISAPNP=yes
51         PANIC_REBOOT_TIME=0
52         DELAY_LOGIN=yes
53         CLEAN_TMP=no
54         CONSOLE_LOGLEVEL=1
55         LOAD_SOUND=yes
56         SET_SLINKS=yes
57         RUN_LDCONFIG=yes
58 fi
59
60 # Print welcome message
61 nls "\t\t\t%sPowered by %sPLD GNU/Linux%s" "$(termput setaf 6)" "$(termput setaf 2)" "$(termput setaf 7)"
62 if is_yes "$PROMPT"; then
63         nls -n "\t\t     Press %sI%s to enter interactive startup." "$(termput setaf 1)" "$(termput setaf 7)"
64         echo
65         sleep 1
66 fi
67
68 # we need /proc mounted before everything
69 mount -n -o gid=17 -t proc /proc /proc
70
71 # /dev must be also mounted before everything but only if we want use them ;-)
72 if is_yes "$MOUNT_DEVFS"; then
73     run_cmd "Mounting Device Filesystem" mount -n -t devfs /dev /dev
74 fi
75
76 # set up devfsd
77 if [ -c /dev/.devfsd -a -x /sbin/devfsd ]; then
78         run_cmd "Starting Device Filesystem Daemon" /sbin/devfsd /dev
79         if [ -e /dev/cdroms/cdrom0 ]; then
80                 ln -sf /dev/cdroms/cdrom0 /dev/cdrom
81         fi
82         if [ -f /etc/sysconfig/mouse ]; then
83                 . /etc/sysconfig/mouse
84                 if [ -n "$DEVICE" -a "$DEVICE" != "/dev/mouse" ]; then
85                         ln -s $DEVICE /dev/mouse
86                 fi
87         fi
88 fi
89
90 # Set console loglevel
91 /bin/dmesg -n $CONSOLE_LOGLEVEL
92
93 # Configure Linux kernel
94 run_cmd "Configuring kernel parameters" /sbin/sysctl -p /etc/sysctl.conf
95
96 # Set the system clock.
97 ARC=0
98 SRM=0
99 UTC=0
100
101 if [ -f /etc/sysconfig/clock ]; then
102    . /etc/sysconfig/clock
103
104    # convert old style clock config to new values
105    if [ "${CLOCKMODE}" = "GMT" ]; then
106       UTC=true
107    elif [ "${CLOCKMODE}" = "ARC" ]; then
108       ARC=true
109    fi
110 fi
111
112 if grep "system serial" /proc/cpuinfo | grep -q MILO ; then
113    ARC=true
114 fi
115
116 CLOCKDEF=""
117 CLOCKFLAGS="--hctosys"
118
119 case "$UTC" in
120    yes|true)
121     CLOCKFLAGS="$CLOCKFLAGS --utc";
122     CLOCKDEF="$CLOCKDEF (utc)";
123   ;;
124    *)
125     CLOCKFLAGS="$CLOCKFLAGS --localtime";
126     CLOCKDEF="$CLOCKDEF (local)";
127   ;;
128 esac
129
130 case "$ARC" in
131      yes|true)
132         CLOCKFLAGS="$CLOCKFLAGS -A";
133         CLOCKDEF="$CLOCKDEF (arc)";
134      ;;
135 esac
136 case "$SRM" in
137      yes|true)
138         CLOCKFLAGS="$CLOCKFLAGS -S";
139         CLOCKDEF="$CLOCKDEF (srm)";
140      ;;
141 esac
142
143 # Check if timezone definition is available
144 if [ -e /etc/localtime ] ; then
145         if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
146                 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
147         fi
148 else
149         TIME_SETUP_DELAYED=yes
150 fi
151
152 # Start up swapping.
153 run_cmd "Activating swap partitions" swapon -a
154
155 # Set the hostname.
156 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
157
158 # Set the NIS domain name
159 if [ -n "$NISDOMAIN" ]; then
160         run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
161 else
162         domainname ""
163 fi
164
165 # Initialize USB controller and HID devices
166 usb=0
167 if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" /proc/devices 2>/dev/null ; then
168     aliases=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+usb-controller" | awk '{ print $3 }')
169     if [ -n "$aliases" -a "$aliases" != "off" ] ; then
170       /sbin/modprobe -k usbcore
171       run_cmd "Mounting USB filesystem" mount -t usbdevfs usbdevfs /proc/bus/usb
172       for alias in $aliases ; do 
173         run_cmd "$(nls 'Initializing USB controller') ($alias)" /sbin/modprobe $alias
174       done
175       [ $? -eq 0 -a -n "$aliases" ] && usb=1
176     fi
177 fi
178
179 if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && grep -q "usb" /proc/devices 2>/dev/null ; then
180   usb=1
181 fi
182
183 needusbstorage=
184 if [ $usb = "1" ]; then
185     sleep 5
186     mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02")
187     kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01")
188     needusbstorage=$(cat /proc/bus/usb/devices 2>/dev/null|grep -e "^I.*Cls=08")
189     if [ -n "$kbdoutput" ] || [ -n "$mouseoutput" ]; then
190         run_cmd "Initializing USB HID interface" modprobe hid 2> /dev/null
191     fi
192     if [ -n "$kbdoutput" ]; then
193         run_cmd "Initializing USB keyboard" modprobe keybdev
194     fi
195     if [ -n "$mouseoutput" ]; then
196         run_cmd "Initializing USB mouse" modprobe mousedev
197     fi
198 fi
199
200 if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2> /dev/null ; then
201         fastboot=yes
202 else
203         fastboot=
204 fi
205
206 if [ -f /fsckoptions ]; then
207         fsckoptions=$(cat /fsckoptions)
208 else
209         fsckoptions=''
210 fi
211
212 if [ -f /forcefsck ]; then
213         fsckoptions="-f $fsckoptions"
214 fi
215
216 if is_yes "$COLOR_INIT"; then
217         fsckoptions="-C $fsckoptions"
218 else
219         fsckoptions="-V $fsckoptions"
220 fi
221
222 _RUN_QUOTACHECK=0
223 _ROOTFS_TYPE=$(grep " / " /proc/mounts | awk '{ print $3 }')
224
225 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" ]; then 
226             show "Checking root filesystems."; started
227             initlog -c "fsck -T -a $fsckoptions /"
228
229             rc=$?
230
231             # A return of 2 or higher means there were serious problems.
232             if [ $rc -gt 1 ]; then
233                     # don't use '\n' in nls macro !
234                     echo
235                     echo
236                     nls "*** An error occurred during the file system check."
237                     nls "*** Dropping you to a shell; the system will reboot"
238                     nls "*** when you leave the shell."
239                     echo
240
241                     PS1="$(nls '(Repair filesystem)# ')"; export PS1
242                     if is_yes "$RUN_SULOGIN_ON_ERR"; then
243                             sulogin
244                     else
245                             /bin/sh
246                     fi
247
248                     run_cmd "Unmounting file systems" umount -a
249                     mount -n -o remount,ro /
250                     run_cmd "Automatic reboot in progress." reboot
251             elif [ "$rc" = "1" ]; then
252                     _RUN_QUOTACHECK=1
253             fi
254 fi
255
256 # check for arguments 
257 if grep -iq nopnp /proc/cmdline; then
258         PNP=
259 else
260         PNP=yes
261 fi
262
263 # set up pnp and kernel pnp
264 if [ -n "$PNP" ]; then
265     if [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ] && is_yes "$RUN_ISAPNP"; then
266         run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
267     fi
268     if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
269         show "Setting up ISA PNP devices (kernelspace pnp)"; busy
270         cat /etc/isapnp/isapnp-kernel.conf > /proc/isapnp && (deltext; ok) || (deltext; fail)
271     fi
272 fi
273
274 # Remount the root filesystem read-write.
275 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
276
277 # Find and activate volume groups
278 if [ -e /proc/lvm -a -x /sbin/vgscan -a -x /sbin/vgchange -a -e /etc/lvmtab ]; then
279         run_cmd "Scanning for LVM volume groups" /sbin/vgscan && \
280         run_cmd "Activating LVM volume groups" /sbin/vgchange -a y
281 fi
282
283 # Clear mtab
284 >/etc/mtab
285
286 # Remove stale backups
287 rm -f /etc/mtab~ /etc/mtab~~
288
289 # Enter root, /proc and (potentially) /proc/bus/usb and devfs into mtab.
290 mount -f /
291 mount -f /proc
292 [ -f /proc/bus/usb/devices ] && mount -f -t usbdevfs usbdevfs /proc/bus/usb
293 [ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev 
294
295
296 # Setup hdparm thing (if exists and is needed)
297 if ! grep -iq nohdparm /proc/cmdline; then
298         [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
299 fi
300
301 # Update quotas if fsck was run on /.
302 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
303         if [ -x /sbin/convertquota ]; then
304             if [ -f /quota.user ]; then
305                 /sbin/convertquota -u / && rm -f /quota.user
306             fi
307             if [ -f /quota.group ]; then
308                 /sbin/convertquota -g / && rm -f /quota.group
309             fi
310         fi
311         run_cmd "Checking root filesystem quotas"  /sbin/quotacheck -v /
312 fi
313
314 # /etc/nologin when starting system
315 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
316
317 if is_yes "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
318         show "Enabling Delay Login"; busy
319         echo > /etc/nologin
320         nls "System bootup in progress  - please wait" >> /etc/nologin
321         echo >> /etc/nologin
322         chmod 644 /etc/nologin
323         cp -fp /etc/nologin /etc/nologin.boot
324         ok
325 fi
326
327 # The root filesystem is now read-write, so we can now log via
328 # syslog() directly..
329 if [ -n "$IN_INITLOG" ]; then
330     IN_INITLOG=
331 fi
332     
333 echo ${HOSTNAME} > /etc/HOSTNAME
334
335 if [ ! -f /proc/modules ]; then
336         USEMODULES=
337 elif ! grep -iq nomodules /proc/cmdline; then
338         USEMODULES=y
339 else
340         USEMODULES=
341 fi
342
343 # Kernel dependent links
344 rm -f /lib/modules/preferred
345 rm -f /lib/modules/default
346 if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then
347   if is_yes "$SET_SLINKS"; then
348     # Get ready for kmod if module support in the kernel
349     if [ -z $(uname -r | grep "-") ]; then
350         # we're using a new kernel, no preferred needed
351         mver=$(uname -r)
352     else
353         ktag="$(cat /proc/version)"
354         mtag=grep -l "$ktag" /lib/modules/*/.rhkmvtag 2> /dev/null
355         if [ -n "$mtag" ]; then
356             mver=$(echo $mtag | awk ' { gsub(/\/lib\/modules\//,NIL); gsub(/.rhkmvtag/,NIL); gsub(/[     ].*$/,NIL); print $0 } ')
357         fi
358         if [ -n "$mver" ]; then
359             ln -sf /lib/modules/$mver /lib/modules/default
360         fi
361     fi
362     
363     [ -n "$mver" -a -f "/boot/module-info-$mver" ] && \
364         ln -sf /boot/module-info-$mver /boot/module-info
365     [ -n "$mver" -a -f "/boot/System.map-$mver" ] && \
366         ln -sf /boot/System.map-$mver /boot/System.map
367   fi
368 fi
369
370 # Run depmod if RUN_DEPMOD != "no" and:
371 #  a) user requested or RUN_DEPMOD="";
372 #  b) modules.dep is missing
373 #  c) modules.dep is older than /etc/modules.conf or /lib/modules/$mver
374 _RUN_DEPMOD=0
375 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
376   is_yes "$RUN_DEPMOD" && _RUN_DEPMOD=1
377   [ "$RUN_DEPMOD" = "ifmissing" -a ! -r /lib/modules/$mver/modules.dep ] && _RUN_DEPMOD=1
378   [ /lib/modules/$mver/modules.dep -ot /etc/modules.conf ] && _RUN_DEPMOD=1
379   [ /lib/modules/$mver/modules.dep -ot /lib/modules/$mver ] && _RUN_DEPMOD=1
380 fi
381
382 if [ "$_RUN_DEPMOD" = "1" ]; then
383     run_cmd "Finding module dependencies" depmod -a
384 fi
385
386 # Load sound modules iff they need persistent DMA buffers
387 if grep -q "options sound dmabuf=1" /etc/modules.conf 2>/dev/null ; then
388   RETURN=0
389   alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" | awk '{ print $3 }')
390   if [ -n "$alias" -a "$alias" != "off" ] ; then
391       run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -k $alias
392       RETURN=$?
393   fi
394   alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" | awk '{ print $3 }')
395   if [ -n "$alias" -a "$alias" != "off" ] ; then
396       run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -k $alias
397       RETURN=$?
398   fi
399 fi
400
401 if [ -f /proc/sys/kernel/modprobe ]; then
402         if [ -n "$USEMODULES" ]; then
403                 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
404                 sysctl -w kernel.hotplug="/sbin/hotplug" >/dev/null 2>&1
405         else
406                 # We used to set this to NULL, but that causes
407                 # 'failed to exec' messages"
408                 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
409                 sysctl -w kernel.hotplug="/bin/true" >/dev/null 2>&1
410         fi
411 fi
412
413 # Load modules
414 if [ -x /etc/rc.d/rc.modules ]; then
415         /etc/rc.d/rc.modules
416 fi
417
418 # Add raid devices
419 if [ ! -f /proc/mdstat ]; then
420         modprobe -k md >/dev/null 2>&1
421 fi      
422         
423 # Add raid devices
424 if [ -f /proc/mdstat -a -f /etc/raidtab ]; then
425
426         rc=0
427         
428         for i in $(grep -v "^#" /etc/raidtab | grep "raiddev" | awk '{print $2}')
429         do
430                 RAIDDEV=$(basename $i)
431                 RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat)
432                 show "Starting up RAID device %s" $RAIDDEV
433                 busy
434                 if [ -z "$RAIDSTAT" ]; then
435                         # Try raidstart first...if that fails then
436                         # fall back to raid0run and if that fails, too
437                         # fall back to raidadd, raidrun.
438                         RESULT=1
439                         if [ -x /sbin/raidstart ]; then
440                                 /sbin/raidstart $i
441                                 RESULT=$?
442                         fi
443                         if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
444                                 /sbin/raid0run $i
445                                 RESULT=$?
446                         fi
447                         if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
448                                 /sbin/raidadd $i
449                                 /sbin/raidrun $i
450                                 RESULT=$?
451                         fi
452                         if [ $RESULT -gt 0 ]; then
453                                 rc=1
454                                 fail
455                         else
456                                 ok
457                         fi
458                 else
459                         ok
460                 fi
461         done
462
463         # A non-zero return means there were problems.
464         if [ $rc -gt 0 ]; then
465                 show "Starting up RAID devices."; fail
466                 echo
467                 echo
468                 nls "*** An error occurred during the RAID startup"
469                 nls "*** Dropping you to a shell; the system will reboot"
470                 nls "*** when you leave the shell."
471                 echo
472
473                 PS1="$(nls '(RAID Repair)# ')"; export PS1
474                 if is_yes "$RUN_SULOGIN_ON_ERR"; then
475                         sulogin
476                 else
477                         /bin/sh
478                 fi
479
480                 run_cmd "Unmounting file systems" umount -a
481                 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
482                 run_cmd "Automatic reboot in progress" reboot
483         fi
484         show "Starting up RAID devices."; ok
485 fi
486
487 _RUN_QUOTACHECK=0
488 # Check filesystems
489 if [ -z "$fastboot" ] && ! grep -q nofsck /proc/cmdline; then
490         show "Checking filesystems"; started
491         initlog -c "fsck -T -R -A -a $fsckoptions"
492
493         rc=$?
494
495         # A return of 2 or higher means there were serious problems.
496         if [ $rc -gt 1 ]; then
497                 echo
498                 echo
499                 nls "*** An error occurred during the file system check."
500                 nls "*** Dropping you to a shell; the system will reboot"
501                 nls "*** when you leave the shell."
502                 echo
503
504                 PS1="$(nls '(Repair filesystem)# ')"; export PS1
505                 if is_yes "$RUN_SULOGIN_ON_ERR"; then
506                         sulogin
507                 else
508                         /bin/sh
509                 fi
510
511                 run_cmd "Unmounting file systems" umount -a
512                 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
513                 run_cmd "Automatic reboot in progress." reboot
514         elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
515                 _RUN_QUOTACHECK=1
516         fi
517 fi
518
519 # Mount all other filesystems (except for NFS and /proc, which is already
520 # mounted). Contrary to standard usage,
521 # filesystems are NOT unmounted in single user mode.
522 run_cmd "Mounting local filesystems." mount -a -t nonfs,smbfs,ncpfs
523
524 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
525         if [ -x /sbin/convertquota ]; then
526             # try to convert old quotas
527             for mountpt in $(cat /etc/mtab | awk '$4 ~ /quota/{print $2}'); do
528                 if [ -f "$mountpt/quota.user" ]; then
529                     /sbin/convertquota -u $mountpt && \
530                         rm -f $mountpt/quota.user
531                 fi
532                 if [ -f "$mountpt/quota.group" ]; then
533                     /sbin/convertquota -g $mountpt && \
534                         rm -f $mountpt/quota.group
535                 fi
536             done
537         fi
538         run_cmd "Checking filesystem quotas"  /sbin/quotacheck -v -R -a
539 fi
540
541 # Turn on quota
542 if [ -x /sbin/quotaon ]; then
543     run_cmd "Turning on user and group quotas for local filesystems" /sbin/quotaon -a
544 fi
545
546 # Turn on process accounting
547 if [ -x /sbin/accton ] ; then
548         run_cmd "Turning on process accounting" /sbin/accton /var/log/pacct
549 fi
550
551 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
552 if is_yes "$TIME_SETUP_DELAYED"; then
553         if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
554                 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
555         fi
556 fi
557
558 # Initialize the serial ports.
559 if [ -f /etc/rc.d/rc.serial ]; then
560         . /etc/rc.d/rc.serial
561 fi
562
563 if [ -f /proc/sys/kernel/panic -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
564         show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
565         if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME 2> /dev/null); then ok; else fail; fi
566 fi
567
568 # Clean out /etc.
569 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff
570
571 # Clean up /var
572 # I'd use find, but /usr may not be mounted.
573 for afile in /var/lock/* /var/run/*; do
574    if [ -d "$afile" ]; then
575         bafile=$(basename $afile)
576         [ "$bafile" != "news" -a "$bafile" != "sudo" -a "$bafile" != "mon" ] && rm -f $afile/*
577    else
578         rm -f $afile
579    fi
580 done
581
582 {
583 # Clean up utmp/wtmp
584 rm -f /var/run/utmp?
585 if ! is_no "$NEED_XFILES" ; then
586         :>/var/run/utmpx
587         touch /var/log/wtmpx
588         chown root.utmp /var/run/utmpx /var/log/wtmpx
589         chmod 0664 /var/run/utmpx /var/log/wtmpx
590 else
591         :>/var/run/utmp
592         touch /var/log/wtmp
593         chown root.utmp /var/run/utmp /var/log/wtmp
594         chmod 0664 /var/run/utmp /var/log/wtmp
595 fi
596
597 # Clean /tmp
598 if is_yes "$CLEAN_TMP"; then
599         rm -rf /tmp/*
600 fi
601
602 # Delete X locks
603 rm -f /tmp/.X*-lock
604
605 # Delete Postgres sockets
606 rm -f /tmp/.s.PGSQL.*
607
608 # Right, now turn on swap in case we swap to files.
609 swapon -a >/dev/null 2>&1
610 run_cmd "Enabling swap space" /bin/true
611
612 # If a SCSI tape has been detected, load the st module unconditionally
613 # since many SCSI tapes don't deal well with st being loaded and unloaded
614 if [ -f /proc/scsi/scsi ] && grep -q 'Type:   Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
615         if grep -qv ' 9 st' /proc/devices ; then
616                 if [ -n "$USEMODULES" ] ; then
617                         # Try to load the module.  If it fails, ignore it...
618                         insmod -p st >/dev/null 2>&1 && modprobe st >/dev/null 2>&1
619                 fi
620         fi
621 fi
622
623 # Load usb storage here, to match most other things
624 if [ -n "$needusbstorage" ]; then
625         modprobe usb-storage >/dev/null 2>&1
626 fi
627
628 # If they asked for ide-scsi, load it
629 if grep -q "ide-scsi" /proc/cmdline ; then
630         modprobe -k ide-cd >/dev/null 2>&1
631         modprobe -k ide-scsi >/dev/null 2>&1
632 fi
633
634 # Adjust symlinks as necessary in /boot to keep system services from
635 # spewing messages about mismatched System maps and so on.
636 if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
637         ln -s -f System.map-`uname -r` /boot/System.map
638 fi
639 if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
640         ln -s -f System.map-`uname -r` /boot/System.map
641 fi
642
643 # there could be a new kernel version.  remove old psdevtab database
644 rm -f /etc/psdevtab
645
646 # Now that we have all of our basic modules loaded and the kernel going,
647 # let's dump the syslog ring somewhere so we can find it later
648 dmesg > /var/log/dmesg
649 chmod 640 /var/log/dmesg
650 sleep 1
651
652 # Now that we have all of our basic modules loaded and the kernel going,
653 # let's dump the syslog ring somewhere so we can find it later
654 kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
655 } &
656 if is_yes "$PROMPT"; then
657    /sbin/getkey i && touch /var/run/confirm
658 fi
659 wait
660 echo
661
662 # This must be last line !
663 # vi:syntax=sh:tw=78:ts=8:sw=4
664
This page took 0.120856 seconds and 4 git commands to generate.