[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] live-initramfs: Make fetch to work with file on sub dir on tftp server



Hi,
Attached is the patch file to make 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

This patch allows 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.

Hope this helps.

Steven.

-- 
Steven Shiau <steven _at_ nchc org tw> <steven _at_ stevenshiau org>
National Center for High-performance Computing, Taiwan. http://www.nchc.org.tw
Public Key Server PGP Key ID: 1024D/9762755A
Fingerprint: A2A1 08B7 C22C 3D06 34DB  F4BC 08B3 E3D7 9762 755A

--- live.orig	2009-05-14 16:16:21.000000000 +0800
+++ live	2009-05-25 10:29:28.000000000 +0800
@@ -773,9 +773,11 @@
 					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
 							;;
 
 							*)

Reply to: