mkrw /etc

shaulka at 012.net.il shaulka at 012.net.il
Sun May 7 23:54:52 CEST 2006


  I was hoping to test what follows before posting here, but it seems that I 
can't find the  time.

How a similar code to mkrw would work for /etc?

  A pseudo code might be:

1) Have a -b parameter passed as a kernel parameter.
   Probably at least at each append and kernel lines in
   /usr/sbin/make-fai-bootfloppy

2) mv -v $NFSROOT/sbin/sulogin{,.distrib}
   I would put some of this code in the same place that
   etc/rcS.distrib is written. However I couldn't find
   where it is. I did find that etc/rcS is linked to
   sbin/fai in /usr/sbin/make-fai-nfsroot:create_nfsroot().

3) Have the following in the new file
   $NFSROOT/usr/lib/fai/sulogin.sh:


#! /bin/sh

# 1st fai boot script. Used to prepare a ram based tmpfs fs
# before doing the main work by the fai script.
# I guess that we now need to source a sh file both here and
# in the fai script.

#*********************************************************************
#
# fai -- first installation script executed after booting
#
# This script is part of FAI (Fully Automatic Installation)
# (c) 1999-2006 by Thomas Lange, lange at informatik.uni-koeln.de
# Universitaet zu Koeln
#
#*********************************************************************
# 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.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# A copy of the GNU General Public License is available as
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You
# can also obtain it by writing to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#*********************************************************************

#set -xv # for full debugging

export PATH=/usr/local/sbin:/usr/local/bin:/usr/lib/fai:/bin:/sbin:/usr/bin:/usr/sbin:
# some variables
export FAI_VERSION="FAI 2.10, 3 Apr 2006"
rundir=/var/run/fai
stamp=$rundir/FAI_INSTALLATION_IN_PROGRESS
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ramdisk() {

    local os_type sub

    umask 022
    # the type of operating system (linux, sunos)
    os_type=$(uname -s | tr A-Z a-z)
    sub=/usr/lib/fai/subroutines

    [ -f "$stamp" ] && {
       echo "$0, ${FAI_VERSION}, already running. Aborting."
       exit 11
    }

    # are we called as sulogin substitute ?
    if [ "$0" = "/sbin/sulogin" -a "${os_type}" = linux ]; then
        # Solaris has already a writable /tmp directory.
        [ -f $sub-${os_type} ] && {
            echo "$0, ${FAI_VERSION}: Couldn't find $sub-${os_type}."
            exit 12
        }
        . $sub-${os_type}  &&  create_ramdisk
    fi
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main routine

echo "Beginning of $0, ${FAI_VERSION}"

if [ `id -u` -ne 0 ]; then
    echo "Run this program as root."
    exit 1
fi

# exit if we do not run from nfsroot and no parameter is given
if [ ! -f /.THIS_IS_THE_FAI_NFSROOT ]; then
    echo "$0 is only run from the nfsroot."
    exit 2
fi

ramdisk

echo "End of $0, ${FAI_VERSION}"


4) The following lines, taken from
   /usr/sbin/make-fai-nfsroot:create_nfsroot(), should be reviewd.
   Not sure if there aren't more.

    # make little changes to nfsroot, because nfsroot is
    # read only for the install clients
    rm etc/mtab
    ln -s /proc/mounts etc/mtab
    mkdir var/lib/discover etc/sysconfig
    ln -sf /tmp/etc/resolv.conf etc/resolv.conf
    ln -s /usr/sbin/fai etc/init.d/rcS
    # for nis
    [ -d var/yp ] && ln -s /tmp/binding var/yp/binding

5) ln -sv $NFSROOT/usr/lib/fai/sulogin.sh sbin/sulogin
   Possibly in /usr/sbin/make-fai-nfsroot:create_nfsroot().

6) $NFSROOT/usr/lib/fai/sulogin.sh now has stuff that is also
   in $NFSROOT/usr/sbin/fai. There fore, the duplicate code should
   be deleted from $NFSROOT/usr/sbin/fai.


--- /usr/sbin/fai       2006-04-03 16:12:38.000000000 +0300
+++ /usr/sbin/fai       2006-05-06 17:37:26.000000000 +0300
@@ -36,8 +36,6 @@
 romountopt="-o async,noatime,nolock,ro,actimeo=1800"
 fstab=fstab  # Solaris uses vfstab

-# the type of operating system (linux, sunos)
-oclass=$(uname -s | tr a-z A-Z)
 # $classes is now set so we can call hooks before fai-class defines the classes
 classes="DEFAULT $oclass $HOSTNAME LAST"
 faimond=0
@@ -105,10 +103,6 @@
     # no chroot needed
     [ "$FAI_ROOT" = '/' ] && ROOTCMD=

-    # Solaris has already a writable /tmp directory
-    [ "$oclass" = LINUX -a $DO_INIT_TASKS -eq 1 ] && create_ramdisk
-    unset oclass
-
     # directory where temporary log files are stored
     # set default value if nothing is set in fai.conf
     if [ -z "$LOGDIR" -a $DO_INIT_TASKS -eq 1 ]; then


7) Finally, add /etc to the list of directories in
   $NFSROOT/usr/lib/fai/create_ramdisk




More information about the linux-fai-devel mailing list