source: projects/initscripts/trunk/rc.d/rc.sysinit @ 6543

Revision 6543, 19.1 KB checked in by daisuke, 12 years ago (diff)

newer udev support

Line 
1#!/bin/bash
2#
3# /etc/rc.sysinit - run once at boot time
4#
5# Taken in part from Miquel van Smoorenburg's bcheckrc.
6#
7
8# Set the path
9PATH=/bin:/sbin:/usr/bin:/usr/sbin
10export PATH
11
12HOSTNAME=`/bin/hostname`
13HOSTTYPE=`uname -m`
14KERNELRELEASE=`uname -r`
15KERNELVERSION=`echo $KERNELRELEASE | cut -f 1-2 -d.`
16
17# VLEE: make host dependent /etc
18if [ -x /etc/rc.diskless ]; then
19   echo -n "Preparing diskless setup :"
20   if /etc/rc.diskless ; then
21      echo " [  OK  ]"
22   else
23      echo " [  NG  ]"
24   fi
25elif [ -x /DLKit/etc/rc.diskless ]; then
26   echo -n "Preparing diskless setup :"
27   if /DLKit/etc/rc.diskless ; then
28      echo " [  OK  ]"
29   else
30      echo " [  NG  ]"
31   fi
32fi
33
34# Read in config data.
35if [ -f /etc/sysconfig/network ]; then
36    . /etc/sysconfig/network
37else
38    NETWORKING=no
39fi
40
41if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
42    HOSTNAME=localhost
43fi
44
45# Mount /run
46if [ ! -d /run ]; then
47  mkdir -p /run
48fi
49mount -n -t tmpfs none /run >/dev/null 2>&1
50# Mount /proc, /sys
51if [ ! -e /proc/mounts ]; then
52        mount -n -t proc /proc /proc
53        mount -n -t sysfs /sys /sys >/dev/null 2>&1
54fi
55# Mount /dev if not already mount
56if ! (grep -q "/dev devtmpfs" /proc/mounts); then
57        mount -n -t devtmpfs none /dev >/dev/null 2>&1
58fi
59if [ ! -d /proc/bus/usb ]; then
60        modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb
61else
62        mount -n -t usbfs /proc/bus/usb /proc/bus/usb
63fi
64
65# readahead
66if [ -f /.readahead_collect -a -r /etc/sysconfig/readahead ]; then
67    . /etc/sysconfig/readahead
68    if [ "x$READAHEAD_COLLECT" == "xyes" -a ! -f /forcefsck -a -x /sbin/readahead-collector ]; then
69          /sbin/readahead-collector
70    fi
71elif [ -x /sbin/readahead_early ]; then
72    /sbin/readahead_early &
73fi
74
75if [ -x /etc/rc.early.local ]; then
76    . /etc/rc.early.local
77fi
78
79# Source functions
80. /etc/init.d/functions
81
82PLYMOUTH=
83[ -x /usr/bin/plymouth ] && PLYMOUTH=yes
84
85# Print a banner. ;)
86echo -en $"\t\t\tWelcome to "
87[ "$BOOTUP" != "serial" ] && echo -en $"\\033[1;36m"
88echo -en $"Vine"
89[ "$BOOTUP" != "serial" ] && echo -en $"\\033[0;39m"
90echo $" Linux"
91if [ "$PROMPT" != "no" ]; then
92 echo -en $"\t\tPress 'I' to enter interactive startup."
93 echo
94fi
95
96# Fix console loglevel
97/bin/dmesg -n $LOGLEVEL
98
99# read /proc/cmdline once
100cmdline=$(cat /proc/cmdline)
101
102# Initialize hardware
103if [ -f /proc/sys/kernel/modprobe ]; then
104   if ! strstr "$cmdline" nomodules && [ -f /proc/modules ] ; then
105      sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
106   else
107      sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
108   fi
109fi
110
111touch /dev/.in_sysinit >/dev/null 2>&1
112
113# kill nash and start udev
114nashpid=$(pidof nash 2>/dev/null)
115[ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1
116unset nashpid
117if [ ! -f "/lxcroot" ]; then
118    /sbin/start_udev
119fi
120
121# static /dev filesystem
122if [ -x /etc/rc.MAKEDEV ]; then
123   action $"Making and Mounting /dev filesystem: " /etc/rc.d/rc.MAKEDEV
124elif [ -x /DLKit/etc/rc.MAKEDEV ]; then
125   action $"Making and Mounting /dev filesystem: " /DLKit/etc/rc.d/rc.MAKEDEV
126fi
127
128# Load user-defined modules
129for file in /etc/sysconfig/modules/*.modules ; do
130   [ -x $file ] && $file
131done
132
133# Load modules (for backward compatibility with VARs)
134if [ -f /etc/rc.modules ]; then
135        /etc/rc.modules
136fi
137
138# Unmount the initrd, if necessary
139if grep -q /initrd /proc/mounts && ! grep -q /initrd/loopfs /proc/mounts ; then
140   action $"Unmounting initrd: " umount /initrd
141   /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
142fi
143
144# load SCSI modules
145for module in `/sbin/modprobe -c | LC_ALL=C awk '/^alias[[:space:]]+scsi_hostadapter[0-9]*[[:space:]]/ { print $3 }'`
146do
147   if ( modprobe --dry-run $module 2> /dev/null ) ; then
148       action $"Loading SCSI module ($module): " /sbin/modprobe $module
149   fi
150done
151
152# Configure kernel parameters
153update_boot_stage RCkernelparam
154action $"Configuring kernel parameters: " sysctl -e -p /etc/sysctl.conf
155
156# Set the system clock.
157ARC=0
158SRM=0
159UTC=0
160
161if [ -f /etc/sysconfig/clock ]; then
162   . /etc/sysconfig/clock
163
164   # convert old style clock config to new values
165   if [ "${CLOCKMODE}" = "GMT" ]; then
166      UTC=true
167   elif [ "${CLOCKMODE}" = "ARC" ]; then
168      ARC=true
169   fi
170fi
171
172CLOCKDEF=""
173CLOCKFLAGS="$CLOCKFLAGS --hctosys"
174
175case "$UTC" in
176   yes|true)
177    CLOCKFLAGS="$CLOCKFLAGS --utc";
178    CLOCKDEF="$CLOCKDEF (utc)";
179   ;;
180   no|false)
181    CLOCKFLAGS="$CLOCKFLAGS --localtime";
182    CLOCKDEF="$CLOCKDEF (localtime)";
183   ;;
184esac
185
186case "$ARC" in
187     yes|true)
188        CLOCKFLAGS="$CLOCKFLAGS --arc";
189        CLOCKDEF="$CLOCKDEF (arc)";
190     ;;
191esac
192case "$SRM" in
193     yes|true)
194        CLOCKFLAGS="$CLOCKFLAGS --srm";
195        CLOCKDEF="$CLOCKDEF (srm)";
196     ;;
197esac
198
199/sbin/hwclock $CLOCKFLAGS
200
201action $"Setting clock $CLOCKDEF: `date`" date
202
203if [ "`/sbin/consoletype`" = "vt" ]; then
204  # Load keymap
205  if [ -x /bin/loadkeys ]; then
206    KEYTABLE=
207    KEYMAP=
208    if [ -f /etc/sysconfig/console/default.kmap ]; then
209      KEYMAP=/etc/sysconfig/console/default.kmap
210    else
211      if [ -f /etc/sysconfig/keyboard ]; then
212        . /etc/sysconfig/keyboard
213      fi
214      if [ -n "$KEYTABLE" -a -d "/lib/kbd/keymaps" ]; then
215        KEYMAP=$KEYTABLE
216      fi
217    fi
218    if [ -n "$KEYMAP" ]; then
219      # Since this takes in/output from stdin/out, we can't use initlog
220      if [ -n "$KEYTABLE" ]; then
221        echo -n $"Loading default keymap ($KEYTABLE): "
222      else
223        echo -n $"Loading default keymap: "
224      fi
225      loadkeys $KEYMAP < /dev/tty0 > /dev/tty0 2>/dev/null && \
226        success $"Loading default keymap" || failure $"Loading default keymap"
227      echo
228    fi   
229  fi
230fi
231
232# Start up swapping.
233action $"Activating swap partitions: " swapon -a -e
234
235# Set the hostname.
236update_boot_stage RChostname
237action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
238
239# Sync waiting for storage.
240{ rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1
241
242# Device mapper & related initialization
243if ! grep -q -F "device-mapper" /proc/devices >/dev/null 2>&1 ; then
244       modprobe dm-mod >/dev/null 2>&1
245fi
246
247[ -f /etc/mdadm.conf -a -x /sbin/mdadm ] && /sbin/mdadm -As --auto=yes --run
248
249if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then
250        modprobe dm-multipath >/dev/null 2>&1
251        /sbin/multipath -v 0
252        if [ -x /sbin/kpartx ]; then
253                /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a"
254        fi
255fi
256
257if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid.static ]; then
258        modprobe dm-mirror > /dev/null 2>&1
259        dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i)
260        if [ "$?" = "0" ]; then
261                for dmname in $dmraidsets; do
262                        if [[ "$dmname" == isw_* ]] && \
263                           ! strstr "$cmdline" noiswmd; then
264                                continue
265                        fi
266                        /sbin/dmraid.static -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1
267                        /sbin/kpartx -a -p p "/dev/mapper/$dmname"
268                 done
269         fi
270fi
271
272# Start any MD RAID arrays that haven't been started yet
273[ -r /proc/mdstat ] && [ -r /dev/md/md-device-map ] && /sbin/mdadm -IRs
274
275if [ -x /sbin/lvm ]; then
276        action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --sysinit
277        action $"Creating LVM devices:" /sbin/lvm vgscan --mknodes --ignorelockingfailure
278fi
279       
280update_boot_stage RCfsck
281
282if [ -f /fastboot ] || [ -f /lxcroot ] || strstr "$cmdline" fastboot ; then
283        fastboot=yes
284    else
285        fastboot=
286fi
287
288if [ -f /fsckoptions ]; then
289        fsckoptions=`cat /fsckoptions`
290    else
291        fsckoptions=
292fi
293
294READONLY=
295if [ -f /etc/sysconfig/readonly-root ]; then
296        . /etc/sysconfig/readonly-root
297fi
298if strstr "$cmdline" readonlyroot ; then
299        READONLY=yes
300fi
301if strstr "$cmdline" noreadonlyroot ; then
302        READONLY=no
303fi
304                                       
305
306if [ -f /forcefsck ]; then
307        fsckoptions="-f $fsckoptions"
308elif [ -f /.autofsck ] && [ ! -f /lxcroot ]; then
309        echo $"Your system appears to have shut down uncleanly"
310        AUTOFSCK_TIMEOUT=5
311        AUTOFSCK_DEF_CHECK=no
312        [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck
313        if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then
314                AUTOFSCK_OPT=-f
315        else
316                AUTOFSCK_OPT=
317        fi
318
319        if [ "$PROMPT" != "no" ]; then
320                if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then
321                        if /sbin/getkey -c $AUTOFSCK_TIMEOUT -m $"Press N within %d seconds to not force file system integrity check..." n ; then
322                                AUTOFSCK_OPT=
323                        fi
324                else
325                        if /sbin/getkey -c $AUTOFSCK_TIMEOUT -m $"Press Y within %d seconds to force file system integrity check..." y ; then
326                                AUTOFSCK_OPT=-f
327                        fi
328                fi
329                echo
330        else
331                # PROMPT not allowed
332                if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then
333                        echo $"Forcing file system integrity check due to default setting"
334                else
335                        echo $"Not forcing file system integrity check due to default setting"
336                fi
337        fi
338        fsckoptions="$AUTOFSCK_OPT $fsckoptions"
339fi
340
341if [ "$BOOTUP" != "serial" ]; then
342        fsckoptions="-C $fsckoptions"
343else
344        fsckoptions="-V $fsckoptions"
345fi
346 
347_RUN_QUOTACHECK=0
348ROOTFSTYPE=`grep " / " /proc/mounts | awk '{ print $3 }'`
349if [ -z "$fastboot" -a "$READONLY" != "yes" -a "$ROOTFSTYPE" != "nfs" -a "$ROOTFSTYPE" != "reiserfs" -a "$ROOTFSTYPE" != "unionfs" -a "$ROOTFSTYPE" != "squashfs" ]; then
350
351        STRING=$"Checking root filesystem"
352        echo $STRING
353        fsck -T -a $fsckoptions /
354        rc=$?
355       
356        if [ "$rc" = "0" ]; then
357                success "$STRING"
358                echo
359        elif [ "$rc" = "1" ]; then
360                passed $"$STRING"
361                echo
362        fi
363       
364        # A return of 2 or higher means there were serious problems.
365        if [ $rc -gt 1 ]; then
366                [ -n "$PLYMOUTH" ] && plymouth --hide-splash
367
368                failure "$STRING"
369                echo
370                echo
371                echo $"*** An error occurred during the file system check."
372                echo $"*** Dropping you to a shell; the system will reboot"
373                echo $"*** when you leave the shell."
374
375                PS1=$"(Repair filesystem) \# # "; export PS1
376                sulogin
377
378                echo $"Unmounting file systems"
379                umount -a
380                mount -n -o remount,ro /
381                echo $"Automatic reboot in progress."
382                reboot -f
383        elif [ "$rc" = "1" ]; then
384                _RUN_QUOTACHECK=1
385        fi
386fi
387
388update_boot_stage RCquotacheck
389
390# Possibly update quotas if fsck was run on /.
391grep -E '[[:space:]]+/[[:space:]]+' /etc/fstab | \
392    awk '{ print $4 }' | \
393    grep -q quota
394_ROOT_HAS_QUOTA=$?
395if [ X"$_RUN_QUOTACHECK" = X1 -a \
396    "$_ROOT_HAS_QUOTA" -a \
397    -x /sbin/quotacheck ]; then
398        if [ -x /sbin/convertquota ]; then
399            if [ -f /quota.user ]; then
400                action $"Converting old user quota files: " \
401                    /sbin/convertquota -u / && rm -f /quota.user
402            fi
403            if [ -f /quota.group ]; then
404                action $"Converting old group quota files: " \
405                    /sbin/convertquota -g / && rm -f /quota.group
406            fi
407        fi
408        action $"Checking root filesystem quotas: " /sbin/quotacheck -nug /
409fi
410
411# check for arguments passed from kernel
412
413update_boot_stage RCmountfs
414
415# Remount the root filesystem in specified mode
416state=`awk '/(^\/dev\/root| \/ )/ { print $4 }' /proc/mounts`
417newstate=`awk '/^#/{next} $2 == "/" {print $4 }'  /etc/fstab`
418if strstr "$cmdline" no_remount_rootfs ;then
419    action $"Staying readonly root filesystem mode : " /bin/true
420else
421    [ "$state" != "rw" ] && [ ! -f "/lxcroot" ] && \
422      action $"Remounting root filesystem in specified mode($newstate): " mount -n -o remount,$newstate /
423fi
424
425if [ "$READONLY" != "yes" ]; then
426    # Clear mtab
427    (>/etc/mtab) &> /dev/null
428
429    # Remove stale backups
430    rm -f /etc/mtab~ /etc/mtab~~
431
432    # Enter root, /proc and (potentially) /proc/bus/usb and devfs into mtab.
433    mount -f /
434    mount -f /proc >/dev/null 2>&1
435    mount -f /sys >/dev/null 2>&1
436    mount -f /dev/pts >/dev/null 2>&1
437    mount -f /dev/shm >/dev/null 2>&1
438    mount -f /proc/bus/usb >/dev/null 2>&1
439fi
440
441if strstr "$cmdline" hdparm ;then
442update_boot_stage RChdparm
443
444# Turn on harddisk optimization
445# There is only one file /etc/sysconfig/harddisks for all disks
446# after installing the hdparm-RPM. If you need different hdparm parameters
447# for each of your disks, copy /etc/sysconfig/harddisks to
448# /etc/sysconfig/harddiskhda (hdb, hdc...) and modify it.
449# each disk which has no special parameters will use the defaults.
450 
451disk[0]=s; disk[1]=hda; disk[2]=hdb; disk[3]=hdc;
452disk[4]=hdd; disk[5]=hde; disk[6]=hdf; disk[7]=hdg; disk[8]=hdh;
453 
454 
455if [ -x /sbin/hdparm ]; then
456   for device in 0 1 2 3 4 5 6 7 8; do
457   unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
458        if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then
459                . /etc/sysconfig/harddisk${disk[$device]}
460                HDFLAGS[$device]=
461                if [ -n "$MULTIPLE_IO" ]; then
462                    HDFLAGS[$device]="-q -m$MULTIPLE_IO"
463                fi
464                if [ -n "$USE_DMA" ]; then
465                    HDFLAGS[$device]="${HDFLAGS[$device]} -q -d$USE_DMA"
466                fi
467                if [ -n "$EIDE_32BIT" ]; then
468                    HDFLAGS[$device]="${HDFLAGS[$device]} -q -c$EIDE_32BIT"
469                fi
470                if [ -n "$LOOKAHEAD" ]; then
471                    HDFLAGS[$device]="${HDFLAGS[$device]} -q -A$LOOKAHEAD"
472                fi
473                if [ -n "$EXTRA_PARAMS" ]; then
474                    HDFLAGS[$device]="${HDFLAGS[$device]} $EXTRA_PARAMS"
475                fi
476        else
477                HDFLAGS[$device]="${HDFLAGS[0]}"
478        fi
479        if [ -e "/proc/ide/${disk[$device]}/media" ] ; then
480             hdmedia=`cat /proc/ide/${disk[$device]}/media`
481             if [ "$hdmedia" = "disk" ]; then
482                  if [ -n "${HDFLAGS[$device]}" ]; then
483                      action $"Setting hard drive parameters for ${disk[$device]}: "  /sbin/hdparm ${HDFLAGS[$device]} /dev/${disk[$device]}
484                  fi
485             fi
486        fi
487   done
488fi
489fi
490
491# The root filesystem is now read-write, so we can now log via syslog() directly..
492if [ -n "$IN_INITLOG" ]; then
493    IN_INITLOG=
494fi
495
496update_boot_stage RCfsck
497
498_RUN_QUOTACHECK=0
499# Check filesystems
500if [ -z "$fastboot" ]; then
501        STRING=$"Checking filesystems"
502        echo $STRING
503        fsck -T -R -A -a $fsckoptions
504        rc=$?
505        if [ "$rc" = "0" ]; then
506                success "$STRING"
507                echo
508        elif [ "$rc" = "1" ]; then
509                passed "$STRING"
510                echo
511        fi
512
513        # A return of 2 or higher means there were serious problems.
514        if [ $rc -gt 1 ]; then
515                failure "$STRING"
516                echo
517                echo
518                echo $"*** An error occurred during the file system check."
519                echo $"*** Dropping you to a shell; the system will reboot"
520                echo $"*** when you leave the shell."
521
522                PS1=$"(Repair filesystem) \# # "; export PS1
523                sulogin
524
525                echo $"Unmounting file systems"
526                umount -a
527                mount -n -o remount,ro /
528                echo $"Automatic reboot in progress."
529                reboot -f
530        elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
531                _RUN_QUOTACHECK=1
532        fi
533fi
534
535update_boot_stage RClocalfs
536
537# Mount all other filesystems (except for NFS and /proc, which is already
538# mounted). Contrary to standard usage,
539# filesystems are NOT unmounted in single user mode.
540if [ "$READONLY" != "yes" ] ; then
541    action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev >/dev/null 2>&1
542else
543    action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev >/dev/null 2>&1
544fi
545
546# check remaining quotas other than root
547if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
548        if [ -x /sbin/convertquota ]; then
549            # try to convert old quotas
550            for mountpt in `cat /etc/mtab | awk '$4 ~ /quota/{print $2}'`; do
551                if [ -f "$mountpt/quota.user" ]; then
552                    action $"Converting old user quota files: " \
553                    /sbin/convertquota -u $mountpt && \
554                        rm -f $mountpt/quota.user
555                fi
556                if [ -f "$mountpt/quota.group" ]; then
557                    action $"Converting old group quota files: " \
558                    /sbin/convertquota -g $mountpt && \
559                        rm -f $mountpt/quota.group
560                fi
561            done
562        fi
563        action $"Checking local filesystem quotas: " /sbin/quotacheck -aRnug
564fi
565
566if [ -x /sbin/quotaon ]; then
567    action $"Enabling local filesystem quotas: " /sbin/quotaon -aug
568fi
569
570# Configure machine if necessary.
571if [ -f /.unconfigured ]; then
572    if [ -x /usr/bin/plymouth ]; then
573        /usr/bin/plymouth quit
574    fi
575    if [ -x /usr/bin/system-config-keyboard ]; then
576        /usr/bin/system-config-keyboard
577    fi
578    if [ -x /usr/bin/passwd ]; then
579        /usr/bin/passwd root
580    fi
581    if [ -x /usr/sbin/system-config-network-tui ]; then
582        /usr/sbin/system-config-network-tui
583    fi
584    if [ -x /usr/sbin/timeconfig ]; then
585        /usr/sbin/timeconfig
586    fi
587    if [ -x /usr/sbin/authconfig-tui ]; then
588        /usr/sbin/authconfig-tui --nostart
589    fi
590    if [ -x /usr/sbin/ntsysv ]; then
591        /usr/sbin/ntsysv --level 35
592    fi
593
594    # Reread in network configuration data.
595    if [ -f /etc/sysconfig/network ]; then
596        . /etc/sysconfig/network
597
598        # Reset the hostname.
599        action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
600    fi
601
602    rm -f /.unconfigured
603fi
604
605# Clean out /etc.
606rm -f /fastboot /fsckoptions /forcefsck /.autofsck /halt /poweroff
607
608# Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might...
609_NEED_XFILES=
610[ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1
611
612# Clean up /var
613rm -rf /var/lock/cvs/* /var/run/screen/*
614find /var/lock /var/run -type f -exec rm -f {} \;
615
616rm -f /var/lib/rpm/__db* &> /dev/null
617rm -f /var/gdm/.gdmfifo &> /dev/null
618
619{
620# Clean up utmp/wtmp
621>/var/run/utmp
622touch /var/log/wtmp /var/log/btmp
623chgrp utmp /var/run/utmp /var/log/wtmp
624chmod 0664 /var/run/utmp /var/log/wtmp
625chmod 0600 /var/log/btmp
626if [ -n "$_NEED_XFILES" ]; then
627  >/var/run/utmpx
628  touch /var/log/wtmpx
629  chgrp utmp /var/run/utmpx /var/log/wtmpx
630  chmod 0664 /var/run/utmpx /var/log/wtmpx
631fi
632
633# Clean up various /tmp bits
634rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* \
635      /tmp/.esd/*
636rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
637       /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-*  \
638       /tmp/scrollkeeper-*  /tmp/ssh-* \
639       /dev/.in_sysinit
640# Make ICE directory
641mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1
642chown root:root /tmp/.ICE-unix
643
644# Now turn on swap in case we swap to files.
645update_boot_stage RCswap
646action $"Enabling swap space: " swapon -a -e
647
648# Initialize the serial ports.
649if [ -f /etc/rc.serial ]; then
650        . /etc/rc.serial
651fi
652
653update_boot_stage RCusbstorage
654
655# Load usb storage here, to match most other things
656if [ -n "$needusbstorage" ]; then
657        modprobe usb-storage >/dev/null 2>&1
658fi
659
660# Adjust symlinks as necessary in /boot to keep system services from
661# spewing messages about mismatched System maps and so on.
662if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ]; then
663        ln -s -f System.map-`uname -r` /boot/System.map
664fi
665if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
666        ln -s -f System.map-`uname -r` /boot/System.map
667fi
668
669# Now that we have all of our basic modules loaded and the kernel going,
670# let's dump the syslog ring somewhere so we can find it later
671dmesg -s 131072 > /var/log/dmesg
672# Also keep kernel symbols around in case we need them for debugging
673i=5
674while [ $i -ge 0 ] ; do
675        if [ -f /var/log/ksyms.$i ] ; then
676                mv /var/log/ksyms.$i /var/log/ksyms.$(($i+1))
677        fi
678        i=$(($i-1))
679done
680_ksyms=/proc/kallsyms
681(/bin/date;
682 /bin/uname -a;
683 /bin/cat /proc/cpuinfo;
684 /bin/cat /proc/modules;
685 /bin/cat ${_ksyms}) >/var/log/ksyms.0
686# create the crash indicator flag to warn on crashes, offer fsck with timeout
687touch /.autofsck
688kill -TERM `/sbin/pidof getkey` >/dev/null 2>&1
689} &
690if [ "$PROMPT" != "no" ]; then
691   /sbin/getkey i && touch /var/run/confirm
692fi
693wait
694
695# let plymouth know that we're leaving rc.sysinit
696if [ -x /usr/bin/plymouth ]; then
697    /usr/bin/plymouth --sysinit
698fi
699   
Note: See TracBrowser for help on using the repository browser.