summaryrefslogtreecommitdiffstats
path: root/initramfs
diff options
context:
space:
mode:
authorDirk von Suchodoletz2007-07-19 18:32:26 +0200
committerDirk von Suchodoletz2007-07-19 18:32:26 +0200
commit572f3cfeedc2f550a7575cb830d53cb09dc8e9e6 (patch)
treecc3c1ed05638fcbdd5417ff47c03705753a04185 /initramfs
parentMinor fixes ... (diff)
downloadcore-572f3cfeedc2f550a7575cb830d53cb09dc8e9e6.tar.gz
core-572f3cfeedc2f550a7575cb830d53cb09dc8e9e6.tar.xz
core-572f3cfeedc2f550a7575cb830d53cb09dc8e9e6.zip
Rewrite of tftp fileget - should be possible to use other servers than
serverip (next-server) ... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1257 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rw-r--r--initramfs/initrd-stuff/etc/functions55
-rwxr-xr-xinitramfs/initrd-stuff/init15
-rwxr-xr-xinitramfs/mkdxsinitrd4
3 files changed, 53 insertions, 21 deletions
diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions
index 1690b03b..99d06fe6 100644
--- a/initramfs/initrd-stuff/etc/functions
+++ b/initramfs/initrd-stuff/etc/functions
@@ -329,6 +329,8 @@ echo "dhcp finished at $(sysup)" > /tmp/dhcp-done
unpack () {
# $1 is config file name to get, $2 IP of server to get file from
local dst=$1
+echo "unpacking $dst" >>/tmp/fileblub
+ls -al $dst >>/tmp/fileblub
if [ -s $dst ] ; then
# fixme: handle different types of packaging (gzip/bzip2)??
if ! tar -xpzf $dst 2> /tmp/ConfTGZ-tar-error ; then
@@ -344,34 +346,57 @@ fi
}
fileget () {
# get type of tftp available, alternatively use wget for ftp or http
-# (fixme: rewrite of fileget needed!!)
-# analyze file soure (URI) in $filesrc
-if [ -n "$filesrc" ] ; then
- local srvproto=$(uri_token $filesrc prot)
- local cfgfile="/$(uri_token $filesrc path)"
- local tftpserver=$(checkip $(uri_token $filesrc server))
- tftp -g -r $cfgfile -l /tmp/$(basename $cfgfile) $tftpserver 2>/dev/null \
- && unpack /tmp/$(basename $cfgfile)
+local cfgfile
+echo "$fileprot $filepath $filepath" > /tmp/fileblub
+[ "x$fileprot" = "x" ] && fileprot=tftp
+if [ "x$filepath" != "x" ] ; then
+ cfgfile=/${filepath}
+ [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip})
+ case "$fileprot" in
+ ftp|http)
+ wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \
+ 2>/dev/null && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ *)
+echo "tftp -g -r /$cfgfile -l /tmp/$(basename $cfgfile) $fileserv" >> /tmp/fileblub
+ tftp -g -r /$cfgfile -l /tmp/$(basename $cfgfile) $fileserv \
+ && unpack /tmp/$(basename $cfgfile)
+ ls -la /tmp/$(basename $cfgfile) >> /tmp/fileblub
+ echo "F: /tmp/$(basename $cfgfile)" >>/tmp/fileblub
+
+ ;;
+ esac
else
# predefined value for openslx environment; it is expected that this
# directory is just below the tftpboot/tftproot (path to which the
# daemon is restricted to)
- local cfgdir="client-config"
- local tftpserver=$(checkip ${serverip})
+ filepath="client-config"
+ [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip})
# try to get configuration files successively; start with distro client
# and try last distro default ...
echo -e "\n## Configuration via fileget: Hierarchy is distro client \
and as last\n# distro/default" >> /tmp/confviafile
mac=$(echo $macaddr|sed "s/:/-/g")
- for cfgfile in $cfgdir/$SYSTEM_NAME/01-$mac.tgz \
- $cfgdir/$SYSTEM_NAME/default.tgz ; do
- tftp -g -r $cfgfile -l /tmp/$(basename $cfgfile) $tftpserver 2>/dev/null \
- && { unpack /tmp/$(basename $cfgfile) && break; }
+ for cfgfile in ${filepath}/${SYSTEM_NAME}/01-$mac.tgz \
+ ${filepath}/${SYSTEM_NAME}/default.tgz ; do
+ case "$fileprot" in
+ ftp|http)
+ wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \
+ 2>/dev/null && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ tftp)
+echo "tftp -g -r /$cfgfile -l /tmp/$(basename $cfgfile) $fileserv" >> /tmp/fileblub
+ tftp -g -r /$cfgfile -l /tmp/$(basename $cfgfile) $fileserv \
+ && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ esac
done
+ ls -la /tmp/$(basename $cfgfile) >> /tmp/fileblub
+ echo "F: /tmp/$(basename $cfgfile)" >>/tmp/fileblub
fi
test -f /initramfs/machine-setup && \
cat /initramfs/machine-setup >> /tmp/confviafile
-echo "fileget via $srvproto finished" > /tmp/file-done
+echo "fileget via $fileprot from $fileserv/$cfgfile finished" >/tmp/file-done
}
#############################################################################
diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init
index e3b64ceb..0e3ed439 100755
--- a/initramfs/initrd-stuff/init
+++ b/initramfs/initrd-stuff/init
@@ -139,7 +139,11 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup
# if configuration should not be gathered by dhcp client
nodhcp)
nodhcp="yes"
- echo "nodhcp" > /tmp/dhcp-done
+ echo "nodhcp" >/tmp/dhcp-done
+ ;;
+ nofile)
+ unset file
+ echo "nofile" >/tmp/file-done
;;
# if ldap configuration should be triggered
ldap)
@@ -152,9 +156,12 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup
rm /tmp/ldap-done
;;
# file source with tftp server and file location on the server
- file=*)
- file="yes"
- filesrc=${opts#file=}
+ file=*|file)
+ if [ "${opts}" != "file" ] ; then
+ fileprot=$(uri_token ${opts#file=} prot)
+ fileserv=$(uri_token ${opts#file=} server)
+ filepath=$(uri_token ${opts#file=} path)
+ fi
;;
# if ld.so.cache should be generated; should be switched on when composing
# rootfs from more than one source
diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd
index cd6365c8..7c83b583 100755
--- a/initramfs/mkdxsinitrd
+++ b/initramfs/mkdxsinitrd
@@ -276,7 +276,7 @@ elif [ -d "$ROOTDIR/usr/share/splash/themes/${theme}" ]; then
themes_dir="/usr/share/splash/themes/${theme}"
fi
-#fixme: very ugly ;)
+#fixme: very ugly ;) shouldn't do anything in $ROOTDIR/tmp
mkdir -p $ROOTDIR/tmp/bootsplash
cp -a $themes_dir/* $ROOTDIR/tmp/bootsplash
themes=${themes_dir%bootsplash}
@@ -557,7 +557,7 @@ if [ -z "$FSMODULES" ] ; then
FSMODULES="nbd nfs"
fi
if [ -z "$INITRD_PATH" ] ; then
- INITRD_PATH="${ROOTDIR}/tmp/slxinitramfs.gz"
+ INITRD_PATH="/tmp/slxinitramfs.gz"
fi
# put all needed modules into initial ramdisk