diff options
author | Dirk von Suchodoletz | 2006-08-16 00:58:42 +0200 |
---|---|---|
committer | Dirk von Suchodoletz | 2006-08-16 00:58:42 +0200 |
commit | 91635afc52c96467e0e994d03284ab65db40526f (patch) | |
tree | a650865536bb684d9478b771d6272dccd9e93876 /initrd/initrd-stuff | |
parent | Simple install mechanism for directory structure setup (make install) (diff) | |
download | core-91635afc52c96467e0e994d03284ab65db40526f.tar.gz core-91635afc52c96467e0e994d03284ab65db40526f.tar.xz core-91635afc52c96467e0e994d03284ab65db40526f.zip |
Extended configuration mechanism (get tgz files instead of simple
machine-setup for advanced config), tested with normal toolset and
busybox, small bugfixes like: fixed duplicate entries to
machine-setup, small ash-sh related bug, ...
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@300 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd/initrd-stuff')
-rwxr-xr-x | initrd/initrd-stuff/bin/servconfig | 15 | ||||
-rw-r--r-- | initrd/initrd-stuff/etc/functions | 34 | ||||
-rwxr-xr-x | initrd/initrd-stuff/init | 15 |
3 files changed, 39 insertions, 25 deletions
diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index 5d266f97..a4577a97 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -4,7 +4,7 @@ # for linux diskless clients (executed within initial # ramdisk) # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 15-08-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 16-08-2006 # Michael Janczyk, 31-05-2006 # Lars Mueller <lm@opendiskless.org>, 23-06-2006 # Oliver Tappe <ot@opendiskless.org>, 23-06-2006 @@ -12,7 +12,7 @@ # Copyright: (c) 2006 - RZ Universitaet Freiburg # (c) 2006 - opendiskless.org project # -# Version: 0.1.2a +# Version: 0.1.2b # check for configuration files to source @@ -65,12 +65,11 @@ echo " cfgcomplete . /etc/machine-setup -# hack for replacing variables ($serverip, $clientip, $host_name) in -# machine-setup -sed -e "s/\$serverip/$serverip/;s/\$clientip/$clientip/" \ - /etc/machine-setup > /etc/machine-setup.new -cp /etc/machine-setup.new /etc/machine-setup -. /etc/machine-setup +# copy additional configuration and var files and directories +# admins can place there files in /var/lib/opendiskless/config/... +# to be packed during stage2 into (/srv/dxs)/tftpboot/client-config...) +# ... in the near future ... +cp -a /rootfs/* /mnt 2>/dev/null ####################################################################### # vmware stuff first part: two scenarios diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 7cf5193e..f2dfe06f 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -2,7 +2,7 @@ # linux diskless clients (included by init, hwautocfg, # servconfig, ... within initial ramdisk) # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 10-08-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 15-08-2006 # Felix Endres, 30-04-2006 # Tobias Maier # @@ -348,13 +348,14 @@ echo "dhcp finished" > /tmp/dhcp-done # from a predefined server or given source (file=tftp-server:/path via # kernel command line) # tftpget is helper function for fileget -tftpget () { +tftpgetunpack () { # $1 is config file name to get, $2 IP of server to get file from for tftp in /bin/atftp /bin/tftp ; do test -x $tftp && break done echo -e "tftp\t69/tcp\ntftp\t69/udp" > /etc/services local dst=/tmp/$(basename $1) +# tftp get part case "$tftp" in */atftp) atftp -g -r $1 -l $dst $2 2> /dev/null @@ -368,6 +369,14 @@ case "$tftp" in fi ;; esac +# unpack part (only gzip is supported) +if [ -s $dst ] ; then + tar -xpzf $dst + rm $dst + return 0 +else + return 1 +fi } fileget () { # get type of tftp available, alternatively use wget for ftp or http @@ -377,7 +386,7 @@ if [ -n "$FILESRC" ] ; then srvproto=$(uri_token $FILESRC prot) cfgfile="/$(uri_token $FILESRC path)" tftpserver=$(uri_token $FILESRC server) - tftpget $tftp $cfgfile $tftpserver + tftpgetunpack $tftp $cfgfile $tftpserver else cfgdir="/tftpboot/client-config/" local tftpserver=$serverip @@ -386,14 +395,14 @@ else echo -e "\n## Configuration via fileget: Hierarchy is distro client \ and as last\n# distro/default" >> /tmp/confviafile mac=$(echo $MAC|sed "s/:/-/g") - for cfgfile in $cfgdir/$DISTRO/01-$mac $cfgdir/$DISTRO/default ; do - if tftpget $cfgfile $tftpserver ; then - : # unpack the tgz and distribute files - fi + for cfgfile in $cfgdir/$DISTRO/01-$mac.tgz $cfgdir/$DISTRO/default.tgz \ + $cfgdir/01-$mac.tgz $cfgdir/default.tgz ; do + tftpgetunpack $cfgfile $tftpserver && break done fi #echo "# -> $cfgfile" >> /tmp/confviafile -#cat /tmp/$(basename $cfgfile) >> /tmp/confviafile +test -f /initramfs/machine-setup && \ + cat /initramfs/machine-setup >> /tmp/confviafile echo "fileget via $srvproto finished" > /tmp/file-done } @@ -497,9 +506,12 @@ waitfor /tmp/file-done 10000 || error "$error_errfcfg" nonfatal waitfor /tmp/ldap-done 10000 || error "$error_errlcfg" nonfatal # concat the different files now into the central config file, order # matters - ldap data has highest priority -for config in /tmp/confviadhcp /tmp/confviafile /tmp/confvialdap - do test -f $config && cat $config >> /etc/machine-setup -done +if ! [ -f /tmp/cfgcomplete ] ; then + for config in /tmp/confviadhcp /tmp/confviafile /tmp/confvialdap + do test -f $config && cat $config >> /etc/machine-setup + done +echo "config completed" > /tmp/cfgcomplete +fi } ####################################################################### diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 9a1dd9a7..a2560b3f 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -2,12 +2,12 @@ # Description: main script for new type of initial ramdisk for # linux diskless clients version 4 # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 24-07-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 15-08-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg -# (c) 2006 - odlx.org project +# (c) 2006 - opendiskless.org project # -# Version: 0.2.6d +# Version: 0.2.6e # functions common for all distros, messages contains all error and info # output @@ -53,7 +53,8 @@ COWSIZE="50%" RWDIR=/dev/shm NFSRO="nfs" -# run pre init script and user defined preinit.local (see Howto) +# run pre init script and user defined preinit.local, copied by mkdxsinitrd +# from /var/lib/opendiskless/config/... in stage2 preinit [ -x /bin/preinit.local ] && /bin/preinit.local @@ -470,9 +471,11 @@ waitfor /tmp/svcfg 20000 || error "$init_errsw" # should be killed if started within init killall -9 dhcpcd dhclient pump 2>/dev/null cp /etc/machine-setup /mnt/etc -#bash -# post init for some distro specific + +# post init for some distro specific (fixme!! more elegant solution) postinit +[ -s /initramfs/postinit.local ] && \ + cp /initramfs/postinit.local /bin/postinit.local [ -x /bin/postinit.local ] && /bin/postinit.local # start a debug shell in higher debug levels |