source: projects/initscripts/tags/initscripts-8.91.3/rc.d/rc.sysinit @ 3072

Revision 3072, 21.3 KB checked in by daisuke, 13 years ago (diff)

tagging as initscripts-8.91.3

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