diff options
author | Dirk von Suchodoletz | 2006-06-25 22:31:15 +0200 |
---|---|---|
committer | Dirk von Suchodoletz | 2006-06-25 22:31:15 +0200 |
commit | 70ee8e665a76b8868b0affed3a4efd2f51757cf2 (patch) | |
tree | 785770b86e693fe359fa7a4523a2fa55fb2d43f1 /initrd | |
parent | Massive changes for distro specific configurations (mkdxsinitrd, (diff) | |
download | core-70ee8e665a76b8868b0affed3a4efd2f51757cf2.tar.gz core-70ee8e665a76b8868b0affed3a4efd2f51757cf2.tar.xz core-70ee8e665a76b8868b0affed3a4efd2f51757cf2.zip |
Added descriptions, some cleanups, ...
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@250 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd')
-rwxr-xr-x | initrd/initrd-stuff/bin/servconfig | 26 | ||||
-rw-r--r-- | initrd/initrd-stuff/etc/messages | 13 | ||||
-rwxr-xr-x | initrd/initrd-stuff/init | 27 | ||||
-rwxr-xr-x | initrd/mkdxsinitrd | 102 |
4 files changed, 80 insertions, 88 deletions
diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index f27c4055..5dc1f3ff 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -1,8 +1,8 @@ #!/bin/sh # # Description: universal (distro independent) configuration script -# for linux diskless clients (executed within initial -# ramdisk) +# for linux diskless clients (executed within initial +# ramdisk) # # Author(s): Dirk von Suchodoletz <dirk@goe.net>, 23-06-2006 # Michael Janczyk, 31-05-2006 @@ -10,6 +10,7 @@ # Oliver Tappe, 23-06-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg +# (c) 2006 - odlx.org project # # Version: 0.1.1e @@ -47,13 +48,13 @@ while [ $len -le 8 ] ; do done echo " WELCOME TO \n (\l) - __ __ ___ __ __ __ __ __ __ - | | | || | || | | || |_| | | | - | | | || || | | | / |__| - | |___ | || | || |_| | / _ __ - |______||__||__| |__| _____/ |__| |__| |__| + _____ ____ __ __ __ + / _ \ | _ \ | | | |_| | + | | | | | | | | | | \ / + | |_| | | |_| | | |___ / _ \ + \_____/ |_____/ |______| |__| |__| - Diskless Workstation (v4.0/$dstr (c) <dirk@goe.net> + Diskless Workstation (v4.0/$dstr (c) <odlx project> ">/mnt/etc/issue ####################################################################### @@ -225,11 +226,12 @@ fi # copy timezone file defined with language settings [ -z "$TZ" ] && TZ="$timezone" cp /mnt/usr/share/zoneinfo/${TZ} /mnt/etc/localtime 2>/dev/null || \ - error " No such timezone data file (needed for ntp time service \ -configuration)." nonfatal + error "$scfg_ntptz" nonfatal config_ntp -# secure shell server +# secure shell server - at the moment all clients share one "secret" +# key or the key has to be regenerated on every bootup or fetched on +# every bootup from somewhere config_sshd # simple network management protocol agent @@ -323,6 +325,8 @@ fi ####################################################################### # preparation of /tmp directory (partition 44, nfs scratch, ramdisk) +# there might be the chance that we have a disk partition available, so +# wait for completion of detection, setup process waitfor /tmp/tmpready 10000 # create some directories and correct permissions tmpisdisk=`sed -n '/\/tmp/p' /mnt/etc/fstab` diff --git a/initrd/initrd-stuff/etc/messages b/initrd/initrd-stuff/etc/messages index 8e319d19..9876a208 100644 --- a/initrd/initrd-stuff/etc/messages +++ b/initrd/initrd-stuff/etc/messages @@ -1,11 +1,12 @@ -# Description: messages file for all error and info messages generated during -# bootup (within initialramfs) for linux diskless clients -# version 4 -# this file could be used for localization of error messages +# Description: messages file for all error and info messages generated +# during client bootup (within initialramfs) for linux +# diskless clients of version 4 +# this file could be used for localization of error messages # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 01-06-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 24-06-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg +# (c) 2006 - odlx.org project # # Version: 0.0.3f @@ -136,6 +137,8 @@ scfg_errdcfg=" Did not get any configuration data via dhcp until now ..." scfg_errfcfg=" Did not get any configuration data via tftp until now ..." scfg_errlcfg=" Did not get any configuration data via ldap until now ..." scfg_nfs=" Mount of some NFS source failed ..." +scfg_ntptz=" No such timezone data file (needed for ntp time service \ +configuration)." scfg_vmdir=" For some reason the runvmware script is not available for \ copying. That\n could be the result of failed mount or simply missing \ file on\n server." diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 3a9e4a11..2d16d655 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -1,12 +1,13 @@ #!/bin/sh # Description: main script for new type of initial ramdisk for -# linux diskless clients version 4 +# linux diskless clients version 4 # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 28-05-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 24-06-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg -# -# Version: 0.2.4i +# (c) 2006 - odlx.org project +# +# Version: 0.2.4j # functions common for all distros, messages contains all error and info # output @@ -27,14 +28,17 @@ export DISTRO="@@@DISTRO@@@" # do not use dnbd cache file nodnbdcache="yes" +# device files get their own filesystem (to be move mounted later) DEVDIR="/dev" mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${DEVDIR} +# copy basic device files into dev (later udev will handle that) cp -a /tmp/null /tmp/console /dev mkdir -p ${DEVDIR}/pts mkdir -p ${DEVDIR}/shm mkdir -p ${DEVDIR}/.udevdb +# mount the important standard directories [ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc echo 256 > /proc/sys/kernel/real-root-dev [ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys @@ -42,14 +46,15 @@ echo 256 > /proc/sys/kernel/real-root-dev # redirect console (after /dev/console is available, and /dev mounted) exec < /dev/console > /dev/console 2>&1 -# run pre init script +# run pre init script and user defined preinit.local (see Howto) preinit [ -x /bin/preinit.local ] && /bin/preinit.local # start device auto discovery service - distro specific function udev_hotplug -# set defaults and create waitfor files +# set defaults and create special files so that "waitfor" does not waites +# for a configuration option TMPFSSIZE="50%" COWSIZE="50%" RWDIR=/dev/shm @@ -96,7 +101,8 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup ;; # if (external, via tftp) configuration file retrieval should # be triggered, if no source is given try dhcp server and - # predefined standard path + # predefined standard path (~/tftpboot/client-conf/default, + # client-conf/<name-of-export>/default, ...) file) FILE="yes" rm /tmp/file-done @@ -115,7 +121,7 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup UNIONFS=1 UNIONDIRS=${opts#union=} ;; - # if unionfs should be used + # if unionfs should be used over the complete root filesystem unionfs) UNIONFS=1;; # if cowloop should be used, only ontop of network block device and in @@ -124,7 +130,7 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup COWLOOP=1 #COWSIZE=${opts#cowloop=} ;; - # dnbd server:port + # dnbd server:port,filesystem (filesystem is optional) dnbdroot=*) NBD=dnbd # name of kernel module NBDOPT=${opts#dnbdroot=} @@ -149,7 +155,8 @@ nfsroot=\"${NFSROOT}\"\n" >> /etc/machine-setup # size of tempfs if not max. 50% of RAM should be used tmpfssize=*) TMPFSSIZE=${opts#tmpfssize=};; - # vendor code identifier for dhcp requests + # vendor code identifier for dhcp requests, that way odlx clients could + # be distinguished from other (dhcp) clients vci=*) VCI=${opts#vci=};; esac diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd index 9e7c0668..804b2bc2 100755 --- a/initrd/mkdxsinitrd +++ b/initrd/mkdxsinitrd @@ -3,13 +3,14 @@ # Description: universal (distro independent) generator for initial # ramdisks for linux diskless clients # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 23-06-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 24-06-2006 # Nico Dietrich # Felix Endres # -# Version: 0.4.0a -# # Copyright: (c) 2003 - 2006 - RZ Universitaet Freiburg +# (c) 2006 - odlx.org project +# +# Version: 0.4.0a # debug level of script itself DEBUG=1 @@ -34,6 +35,8 @@ COMDIRINDXS="/tmp/scratch /var/lib/nobody" # D_RCDIRS - runlevel directories relative to /etc # D_HWMODTOIGNORE - +# just ensure that variables are set and the user gets an idea if +# something fails D_SYSCONFDIR="<set in ~/distro-config/distro file>" D_ETCEXCL="<set in ~/distro-config/distro file>" D_BINDMPTS="<set in ~/distro-config/distro file>" @@ -56,7 +59,8 @@ D_DEFAULTCOUNTRY="<set in ~/distro-config/distro file>" usage() { - echo -e "mkdxsinitrd [-gh] [-k Kernelversion] [-i Pfad] [-f Module] [-n Module] [-r Pfad] [-s Bildgröße]\n" + echo -e "mkdxsinitrd [-gh] [-k kernel version] [-i path/file] \ +[-f module(s)] [-n module(s)] [-r path] [-s splashsize]\n" echo "OPTIONEN" echo " -g Benutze glibc als Basisbibliothek in der ramdisk." echo " -h Zeige Informationen zur Benutzung." @@ -87,7 +91,7 @@ usage() exit 0 } -# replaces which to find executables inside ROOTDIR +# replaces which command to find executables inside ROOTDIR binfinder() { local PROGRAM="$1" @@ -113,7 +117,6 @@ if [ -z ${FPTB} ] ; then return 1; elif [ -L ${FPTB} ] ; then # do not copy the link but the binary the link points to - local LINKDEST=`ls -la ${FPTB} | sed -e "s,.* ,,"` case $LINKDEST in /*) FPTB=${ROOTDIR}${LINKDEST} @@ -125,7 +128,12 @@ else cp ${FPTB} ${INSTDIR}/${DEST} fi # get an idea which libraries are needed +# fixme: that might not work if executed on different architecture than +# client root is chroot ${ROOTDIR} ldd ${FPTB#${ROOTDIR}*} >> ${INSTDIR}/tmp/libraries +# possible solution: use the server binary, get library names and look +# them up manually - fixme: does ldd understand foreign architecture +# binaries } # replace copy @@ -154,41 +162,7 @@ else fi } -# this function incrementally concats and copies distro-specific functions, -# configuration variables and files copy_distro_stuff() { -# Konzept geaendert!!! -#Konzept der Konfiguration mittels -#functions-* und config-* zu veraendert: Es gibt eine Default-Konfig, die -#dann von der jeweiligen Version angepasst wird - Ketten von sowas wie -#config-9.3 wird von config-10.0 wird von config-10.1 ueberschrieben usw. -#soll durch einfaches config-default -> config-9.3, ... -> config-10.0 -#... abgeloest werden. Das erlaubt langfristig auch dafuer zu sorgen, dass -#im config-def alles Wesentliche bezogen auf die aktuellsten Version drin -#ist. - -# # first insert dependencies -# case $1 in -# suse) -# case $2 in -# 9.3) -# ;; -# 10.0) -# copy_distro_stuff suse 9.3 -# ;; -# 10.1) -# copy_distro_stuff suse 10.0 -# ;; -# esac -# ;; -# debian) -# ;; -# ubuntu) -# ;; -# gentoo) -# ;; -# esac - # copy first the default distro dependent configuration (variables) and # function files, then append to each the distro/version specific file # variables, functions set in default might that way be overwritten by @@ -206,7 +180,8 @@ copy_distro_stuff() { -regex ".*/\..*" -exec rm -rf {} 2>/dev/null \; } -# This function makes the directory of this script to the present working directory +# This function makes the directory of this script to the present working +# directory # It is called within precheck() # Does also work when called by symbolic links (even for nested links). goto_script_dir() @@ -280,7 +255,7 @@ while getopts :hgk:i:r:o:s:f:n:Sut:d:v:I:V:a: a ; do I) NET_IF=$OPTARG;; # Not in use a) acpi_dsdt="$OPTARG";; # Not in use S) use_selinux=1;; # Not in use - l) local_init_script="$OPTARG";; # Not in use + l) local_init_script="$OPTARG";; # use for pre/postinit.local? u) sysfs_root=1 # Not in use use_udev= ;; @@ -296,15 +271,16 @@ shift $(expr $OPTIND - 1) #Change to the directory this script is located in goto_script_dir +# set temporary setup directory, clean it and setup basic directory +# structure if [ -z "$INSTDIR" ] ; then INSTDIR=/tmp/dxs-instrd fi - rm -rf ${INSTDIR} mkdir -p ${INSTDIR}/{dev,proc,tmp,mnt,root,bin,sys,lib} ln -s /bin ${INSTDIR}/sbin mkdir -p ${INSTDIR}/usr/share -# needed for KNOPPIX hwsetup not to confuse with ${D_SYSCONFDIR} +# needed for KNOPPIX hwsetup tool not to be confused with ${D_SYSCONFDIR} mkdir -p ${INSTDIR}/etc/sysconfig # if still no distro name set, try to find it using significant files @@ -330,6 +306,7 @@ specify\nas command line argument (-d <distro-name> -v <distro-version>)" fi fi +# unify the description of distribution and its version case "${DISTRO}" in Debian*|debian*|Sarge*|sarge*) DISTRO=debian @@ -363,8 +340,6 @@ case "${DISTRO}" in case "${DISTRO_VER}" in 9*) DISTRO_VER=9.3 - # might be needed for older udev/hotplug - # cp -a ${ROOTDIR}/etc/hotplug* ${INSTDIR}/etc ;; 10.0) DISTRO_VER=10.0 @@ -373,17 +348,17 @@ case "${DISTRO}" in DISTRO_VER=10.1 ;; esac - - #cp -a /etc/sysconfig/{hardware,network} ${INSTDIR}/etc/sysconfig ;; esac +# ast this point ${DISTRO} ${DISTRO_VER} should be fixed +copy_distro_stuff ${DISTRO} ${DISTRO_VER} -# hotplug/udev style and stuff +# hotplug/udev type and related stuff cp -a ${ROOTDIR}/etc/udev ${INSTDIR}/etc -# an dieser stelle sollte jetzt sichergestellt sein, dass sowohl DISTRO als auch DISTRO_VER eindeutig gesetzt sind! - -copy_distro_stuff ${DISTRO} ${DISTRO_VER} +# binary and corresponding library copies could be avoided if a small +# initial ramdisk environment of its own is generated from busybox, +# dietlibc and similar, see odlx project page ... # devices needed rather early (copied from /tmp to /dev in init) mknod ${INSTDIR}/tmp/console c 5 1 &>/dev/null @@ -391,7 +366,7 @@ mknod ${INSTDIR}/tmp/null c 1 3 &>/dev/null mknod ${INSTDIR}/tmp/kmsg c 1 11 &>/dev/null mknod ${INSTDIR}/tmp/ctl b 241 255 &>/dev/null -#if no klibc - klibc shell seems not to have enough functionality :-( +# find and copy a shell to be used within initialramfs for bbins in bash ash sh; do if cobi ${bbins} bin ; then ln -fs ${bbins} ${INSTDIR}/bin/sh @@ -400,7 +375,7 @@ for bbins in bash ash sh; do else echo "Binary not found (${bbins})"; fi done -# if no klibc +# find and copy ip setup binaries for bbins in ip ifconfig; do if cobi ${bbins} bin ; then [ "${bbins}" = "ifconfig" ] && cobi route bin @@ -408,7 +383,7 @@ for bbins in ip ifconfig; do else echo "Binary not found"; fi done -# needed standard binaries +# needed standard binaries (in init, servconfig, hwautocfg, ... scripts) for bbins in \ cat chmod chown chroot cp expr fdisk killall ln ls mkdir mkfs.ext2 \ modprobe mount portmap rmmod sed sort rm tar umount @@ -425,14 +400,14 @@ mkdir -p ${INSTDIR}/var/{lib,run} # tftp client binary for configuration via file - get machine-setup per # tftp from dhcp (or specified other) server -## irgendwann mal nur konditional ... +#fixme: irgendwann mal nur konditional ... for tftp in atftp tftp ; do binfinder $tftp && break done cobi $tftp bin cp /lib/libnss_files.so.2 ${INSTDIR}/lib -# debug binaries +# binaries useful for debugging purposes if [ $IRFSDEBUG -gt 2 ] ; then for bbins in \ date lsmod lsof ps strace time @@ -441,16 +416,16 @@ if [ $IRFSDEBUG -gt 2 ] ; then done fi -# style of hotplug/udev/dev (for etc directories see above!!) +# type of hotplug/udev/dev (for etc directories see above!!) for bbins in udev udevd udevstart udevtrigger udevsend do cobi ${bbins} bin &>/dev/null || echo "Program ${bbins} not found" done -# if nfs +# if nfs is used as clients root filesystem mkdir -p ${INSTDIR}/var/lib/nfs/state -# if nbd or dnbd +# if nbd or dnbd is used as clients root filesystem if [ -n "${FSMODULES}" ] ; then for i in ${FSMODULES}; do case "$i" in @@ -465,10 +440,12 @@ done fi # if unionfs -cobi unionctl bin &>/dev/null || echo "Program unionctl not found" +cobi unionctl bin &>/dev/null || \ + echo "Program unionctl not found; could be ignored ..." # if cowloop -cobi cowdev bin &>/dev/null || echo "Program cowdev not found" +cobi cowdev bin &>/dev/null || \ + echo "Program cowdev not found; could be ignored ..." # distro specific additional stuff @@ -480,6 +457,7 @@ esac # add needed libraries depending on choosen binaries. use chroot # on ldd, otherwise the detection does not work properly. ldd has to be # static linked binary +# fixme: procedure might have to be changed for lib in `cat ${INSTDIR}/tmp/libraries 2>/dev/null | \ sed -e "s,tls,,;s,i686/cmov,," \ -ne 's:\t\(.* => \)\?\(/.*\) (0x[0-9a-f]*):\2:p' | sort -u` ; do |