#! /bin/sh #---------------------------------------------------------------------------- # /etc/init.d/boot - initial boot script # # Creation : 2001-08-08 Frank Meyer # Last Update: $Id$ # # Copyright (c) 2001-2012 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # don't include eislib, maybe /var is on an other partition and not mounted yet /usr/local/bin/colecho "Running $0" gn # set path PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin; export PATH # include configuration . /etc/config.d/base #---------------------------------------------------------------------------- # mount devices, e.g. /proc #---------------------------------------------------------------------------- cd / swapon -a /bin/mount -n -o remount,ro / 2>/dev/null if [ $? -eq 0 ] then # -C display output with progressbar FSCK_PROGRESS='' if [ "`tty`" = "not a tty" ] then FSCK_PROGRESS="-C" fi # force fsck, if /forcefsck exist # (e.g. from shutdown -rF now) # note that this reboots after fsck # and fsck again, afterwards continue booting FSCK_FORCE='' if [ -f /forcefsck ] then FSCK_FORCE="-f" fi echo "Checking file systems..." /sbin/fsck ${FSCK_PROGRESS} -A -p ${FSCK_FORCE} 2>/dev/null fsck_ret=${?} case ${fsck_ret} in 0|1) # nothing to do ;; 2|3) /bin/sync /sbin/reboot -f ;; *) echo echo "fsck failed. Please repair manually and reboot. The root" echo "file system is currently mounted read-only. To remount it" echo "read-write do:" echo echo " bash# mount -n -o remount,rw /" echo echo "Attention: Only CONTROL-D will reboot the system in this" echo "maintanance mode. shutdown or reboot will not work." echo PS1="(repair filesystem) # " export PS1 /bin/sh /dev/console 2>&1 # if the user has mounted something rw, this should be umounted echo "Unmounting file systems (ignore error messages)" /bin/umount -avn # on umsdos fs this would lead to an error message. so direct # errors to /dev/null /bin/mount -no remount,ro / 2> /dev/null /bin/sync /sbin/reboot -f ;; esac fi for j in /var/boot-ext/* do if [ -f $j ] then /bin/sh $j fi done /bin/sync /bin/umount /initrd 2>/dev/null /bin/mount /proc 2>/dev/null # mount /proc /bin/mount -n -o remount,rw / # remount / rw without writing mtab rm -f /etc/mtab /etc/mtab~ # remove old mtabs rm -f /var/boot-ext/* /bin/mount -av 2>/dev/null # mount remaining fs from fstab # remount all acl enabled filesystems with acl,user_xattr, if kernel supports acl (excluding /boot) for pseudofile in /proc/{ksyms,kallsyms} do if [ -e "$pseudofile" ] then if grep -q 'posix_acl_' "$pseudofile" then /bin/mount -t ext2,ext3,ext4,xfs | while read dev on point type typ options do if [ "$point" != "/boot" ] then /bin/mount -o remount,acl,user_xattr $point fi done fi fi done chmod 644 /etc/mtab # set permission if [ -d /etc/init.d/boot.d ] then for j in /etc/init.d/boot.d/S* # start cleanup scripts do if [ -x $j ] then $j start fi done fi # set hostname /bin/hostname $HOSTNAME # apply environment /bin/sh /var/install/config.d/environment.sh case "$TIME_ZONE" in met|cet|CET) TIME_ZONE='CET';; # compatibility gmt|GMT) TIME_ZONE='GMT' ;; esac /usr/sbin/zic -l $TIME_ZONE # set TIME_ZONE