From 76844afa5692effee6d167ebf21e80e37b30f1ee Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Thu, 19 Jul 2007 17:22:19 +0000 Subject: Repaired uri_token function (no prepend of leading slash is required any more) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1258 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/bin/servconfig | 2 +- initramfs/initrd-stuff/etc/functions | 16 ++++++++-------- initramfs/initrd-stuff/init | 7 ++++--- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'initramfs/initrd-stuff') diff --git a/initramfs/initrd-stuff/bin/servconfig b/initramfs/initrd-stuff/bin/servconfig index 66fe5099..5e676d70 100755 --- a/initramfs/initrd-stuff/bin/servconfig +++ b/initramfs/initrd-stuff/bin/servconfig @@ -126,7 +126,7 @@ if [ "x$vmware" != "x" ] && [ "x$vmware" != "xno" ] ; then elif strinstr "/" "$vmware" ; then vmimgprot=$(uri_token $vmware prot) vmimgserv=$(uri_token $vmware server) - vmimgpath="/$(uri_token $vmware path)" + vmimgpath="$(uri_token $vmware path)" fi if [ -n "${vmimgserv}" ] ; then testmkd /mnt/var/lib/vmware diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 99d06fe6..7c91391c 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -104,8 +104,8 @@ if strinstr ":" "$rest" ; then else tmpval=$rest rest="${rest#*/}" - path="${tmpval#*/}" - server="${tmpval%/$path}" + server="$(echo $tmpval|sed 's,/.*,,')" + path="${tmpval#${server}}" port="" fi # get path and query components - URI path, query @@ -350,7 +350,7 @@ local cfgfile echo "$fileprot $filepath $filepath" > /tmp/fileblub [ "x$fileprot" = "x" ] && fileprot=tftp if [ "x$filepath" != "x" ] ; then - cfgfile=/${filepath} + cfgfile=${filepath} [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip}) case "$fileprot" in ftp|http) @@ -358,8 +358,8 @@ if [ "x$filepath" != "x" ] ; then 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 \ +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 @@ -385,8 +385,8 @@ and as last\n# distro/default" >> /tmp/confviafile 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 \ +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 @@ -848,7 +848,7 @@ include_in_fsroot_union () { case $srvproto in nfs) # nfsroot consists now of two different parts - root_path=/$(uri_token $ROOTFS path) + root_path=$(uri_token $ROOTFS path) nfsserver=$(uri_token $ROOTFS server) mkdir -p /mnt/tmp/${root_path}_${union_id} for proto in tcp udp fail; do diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index 0e3ed439..80d38e8b 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -204,7 +204,7 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup case $srvproto in nfs) # nfsroot consists now of two different parts - nfspath=/$(uri_token $rootfs path) + nfspath=$(uri_token $rootfs path) nfsserver=$(uri_token $rootfs server) echo -e "\n# nfs root information gotten via kernel command \ line in $0\n#nfsroot=\"${nfsserver}:${nfspath}\"\n" >> /etc/machine-setup @@ -212,10 +212,11 @@ line in $0\n#nfsroot=\"${nfsserver}:${nfspath}\"\n" >> /etc/machine-setup *nbd*) nbdmod=$srvproto # get settings for nbd-client, filesystem equals to path in URI - # notation + # notation (remove leading slash from filesystem at the end) nbdhost=$(uri_token $rootfs server) nbdport=$(uri_token $rootfs port) nbdrfst=$(uri_token $rootfs path) + nbdrfst=${nbdrfst#/*} ;; aoe) echo "Not implemented yet" @@ -385,7 +386,7 @@ if [ -n "${nbdmod}" ] ; then # load block device driver if needed modprobe ${MODPRV} ${nbdmod} || error "$init_errnbd" [ -x /bin/mdev ] && mdev -s - [ -z "$nbdrfst" ] && nbdrfst=ext2 + [ -z "$nbdrfst" ] && nbdrfst=squashfs nbdhost=$(checkip $nbdhost) if [ $DEBUGLEVEL -eq 20 ] ; then echo "** starting setup of ${nbdmod} at $(sysup)" -- cgit v1.2.3-55-g7522