Making fetch to work with file on sub dir on tftp server.
authorSteven Shiau <steven@nchc.org.tw>
Mon, 25 May 2009 09:32:12 +0000 (11:32 +0200)
committerDaniel Baumann <daniel@debian.org>
Wed, 9 Mar 2011 16:48:05 +0000 (17:48 +0100)
This patch allows live-initramfs to fetch file from sub
dir on tftp server. The original one from live-initramfs 1.157.2 only
works for the file existing on the root of tftp server, e.g.
fetch=tftp://192.168.101.254/filesystem.squashfs

It allows the PXE client to get the file either on the root, or on
the sub dir, e.g. fetch=tftp://192.168.101.254/live/filesystem.squashfs
is working now.

scripts/live

index 4a793ad..683afa2 100755 (executable)
@@ -773,9 +773,11 @@ do_httpmount ()
                                        then
                                                case "$url" in
                                                        tftp*)
-                                                               ip="$(dirname $url | sed -e 's|tftp://||g')"
-                                                               log_begin_msg "Trying tftp -g -b 10240 -r $(basename ${url})  -l ${dest}/$(basename ${url}) $ip"
-                                                               tftp -g -b 10240 -r $(basename ${url})  -l ${dest}/$(basename ${url}) $ip
+                                                               ip="$(dirname $url | sed -e 's|tftp://||g' -e 's|/.*$||g')"
+                                                               rfile="$(echo $url | sed -e "s|tftp://$ip||g")"
+                                                               lfile="$(basename $url)"
+                                                               log_begin_msg "Trying tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip"
+                                                               tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip
                                                        ;;
 
                                                        *)