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

Revision 8038, 19.2 KB checked in by daisuke, 10 years ago (diff)

add detect_container()

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