summaryrefslogtreecommitdiffstats
path: root/initramfs/initrd-stuff/etc/functions
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/initrd-stuff/etc/functions
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/initrd-stuff/etc/functions')
-rw-r--r--initramfs/initrd-stuff/etc/functions55
1 files changed, 40 insertions, 15 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
}
#############################################################################