SystemRescueCD

Z DCEwiki
Verze z 29. 10. 2009, 18:16, kterou vytvořil Keny (diskuse | příspěvky) (Založena nová stránka: <source lang="diff"> --- srcd_orig/init 2008-05-04 11:43:18.970571792 +0200 +++ srcd/init 2008-05-04 10:01:01.120795531 +0200 @@ -35,12 +35,12 @@ { url="$1" echo "You …)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Skočit na navigaci Skočit na vyhledávání
--- srcd_orig/init 2008-05-04 11:43:18.970571792 +0200 
+++ srcd/init 2008-05-04 10:01:01.120795531 +0200 
@@ -35,12 +35,12 @@ 
{ 
url="$1" 
echo "You requested a network boot, the ${LOOPDAT} image will be loaded " 
- echo "through HTTP or TFTP. You have to provide the URL of the ${LOOPDAT} file " 
- echo "to boot from. (eg: \"http://192.168.1.5/${LOOPDAT}\" or \"tftp://192.168.1.5/${LOOPDAT}\"): " 
+ echo "through HTTP or TFTP or NFS. You have to provide the URL of the ${LOOPDAT} file " 
+ echo "to boot from. (eg: \"http://192.168.1.5/${LOOPDAT}\" or \"tftp://192.168.1.5/${LOOPDAT}\" or \"nfs://192.168.1.5/${LOOPDAT}\"): " 
echo "> " 
- while ! echo "${url}" | grep -q -E '^http://|^tftp://' 
+ while ! echo "${url}" | grep -q -E '^http://|^tftp://|^nfs://' 
do 
- [ "${url}" != 'ask' ] && echo "Invalid http/tftp url (${url})" 
+ [ "${url}" != 'ask' ] && echo "Invalid http/tftp/nfs url (${url})" 
read -p "<< URL of the ${LOOPDAT} to boot from:> " url 
done 
echo "${url}" 
@@ -50,6 +50,7 @@ 
{ 
echo "${1}" | grep -q '^http://' && return 0 
echo "${1}" | grep -q '^tftp://' && return 0 
+ echo "${1}" | grep -q '^nfs://' && return 0 
return 1 
} 

@@ -103,14 +104,14 @@ 

if ! is_valid_bootnet_url "${NETBOOT}" 
then 
- echo "You requested a network boot, the netboot address is not a valid http:// or tftp:// url." 
+ echo "You requested a network boot, the netboot address is not a valid http:// or tftp:// or nfs:// url." 
NETBOOT="$(ask_netboot_url ${NETBOOT} )" 
fi 

good_msg "Downloading ${LOOPDAT} from ${NETBOOT}" 
- if [ -z "$(which wget)" ] || [ -z "$(which tftp)" ] 
+ if [ -z "$(which wget)" ] || [ -z "$(which tftp)" ] || [ -z "$(which mount.nfs)" ] 
then 
- bad_msg "Cannot find wget or tftp then cannot download the ${LOOPDAT} boot file." 
+ bad_msg "Cannot find wget or tftp or mount.nfs then cannot download the ${LOOPDAT} boot file." 
sysresccd_runshell 
fi 

@@ -125,7 +126,7 @@ 
elif echo "${NETBOOT}" | grep -q '^tftp://' 
then 
REAL_ROOT="tftp" 
- url="$(echo ${NETBOOT} | sed 's!tftp://!!g')" # remote the 'tftp://' prefix 
+ url="$(echo ${NETBOOT} | sed 's!tftp://!!g')" # remove the 'tftp://' prefix 
tftpip="${url%%/*}" 
tftpurl="/${url#*/}" 
BOOTMD5=$(echo ${tftpurl} | sed -e "s/${LOOPDAT}/${LOOPMD5}/g") # URL of the md5 file 
@@ -135,11 +136,22 @@ 
cmd2="tftp -g -r ${tftpurl} -l /cdrom/root/${LOOPDAT} ${tftpip}" 
echo "$cmd2" 
${cmd2} ; res2="$?" 
+ elif echo "${NETBOOT}" | grep -q '^nfs://' 
+ then 
+ REAL_ROOT="nfs" 
+ url="$(echo ${NETBOOT} | sed 's!nfs://!!g')" # remove the 'nfs://' prefix 
+ nfsip="${url%%/*}" 
+ nfsurl="/${url#*/}" 
+ nfspath=$(echo ${nfsurl} | sed "s!${LOOPDAT}!!g") # remove the file from the path 
+ cmd1="mount.nfs ${nfsip}:${nfspath} /cdrom/root/ -n -o ro,nolock" 
+ echo "$cmd1" 
+ ${cmd1} ; res1="$?" 
+ res2=0 
fi 

if [ "$res1" != '0' ] || [ "$res2" != '0' ] 
then 
- bad_msg "Cannot download the files, wget/tftp failed." 
+ bad_msg "Cannot download the files, wget/tftp/nfs failed." 
sysresccd_runshell 
fi 

@@ -885,7 +897,7 @@ 
got_good_root=0 

# Check for a block device or http/tftp 
- elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "http" ] || [ "${REAL_ROOT}" = "tftp" ] 
+ elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "http" ] || [ "${REAL_ROOT}" = "tftp" ] || [ "${REAL_ROOT}" = "nfs" ] 
then 
got_good_root=1