Topic: [PATCH] Initrd-patch to allow tftp tranfser for filesystem.squashfs
Hello everybody,
according to the page http://gparted.sourceforge.net/livepxe.php it is only possible to pass http and ftp links to fetch the main "filesystem.squashfs".
I've created a patch for the "live" script which resides inside the initramfs to allow tftp download using command line:
"fetch=tftp://1.2.3.4/path/filesystem.squashfs"
--- live 2008-06-09 12:24:19.000000000 +0000
+++ live.jz 2008-06-09 12:23:27.000000000 +0000
@@ -701,23 +701,53 @@
{
rc=1
extension=$(echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/')
-
- case "${extension}" in
- squashfs|tgz|tar)
- [ "${quiet}" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})"
- mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}"
- wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
- [ ${?} -eq 0 ] && rc=0
- [ "${extension}" = "tgz" ] && live_dest="ram"
- ;;
-
- *)
- [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}"
- esac
+
+ # http://url
+ # ftp://url
+ # tftp://ip/filename
+
+ FETCHMODE=$(echo ${FETCH}" | cut -d ':' -f1)
+
+ if [ "${FETCHMODE}" = "http"] || [ "${FETCHMODE}" = "ftp"]
+ then
+
+ case "${extension}" in
+ squashfs|tgz|tar)
+ [ "${quiet}" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})"
+ mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}"
+ wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
+ [ ${?} -eq 0 ] && rc=0
+ [ "${extension}" = "tgz" ] && live_dest="ram"
+ ;;
+
+ *)
+ [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}"
+ esac
+ elif [ "${FETCHMODE}" = "tftp" ]
+ then
+ case "${extension}" in
+ squashfs|tgz|tar)
+ [ "${quiet}" != "y" ] && log_begin_msg "Trying tftp ${FETCH} -O ${mountpoint}/$(basename ${FETCH})"
+ mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}"
+ IP=$(echo ${FETCH} | cut -d '/' -f3)
+ FILENAME=$(echo ${FETCH} | cut -d '/' -f4-)
+ tftp -g -r "${FILENAME}" "${IP}" -l "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
+ [ ${?} -eq 0 ] && rc=0
+ [ "${extension}" = "tgz" ] && live_dest="ram"
+ ;;
+
+ *)
+ [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}"
+ esac
+ else
+ [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized transport for ${FETCH}"
+ fi
return ${rc}
}
+
+
do_nfsmount ()
{
rc=1