|
1 | | ---- casper 2017-05-14 00:09:40.000000000 +0000 |
2 | | -+++ casper.new 2019-11-16 07:47:52.791003189 +0000 |
3 | | -@@ -33,6 +33,10 @@ |
4 | | - parse_cmdline() { |
5 | | - for x in $(cat /proc/cmdline); do |
6 | | - case $x in |
7 | | -+ netboot=*) |
8 | | -+ export NETBOOT="${x#netboot=}";; |
9 | | -+ fetch=*) |
10 | | -+ export URL="${x#fetch=}";; |
11 | | - showmounts|show-cow) |
12 | | - export SHOWMOUNTS='Yes' ;; |
13 | | - persistent) |
14 | | -@@ -212,20 +216,34 @@ |
15 | | - NFSROOT=${ROOTSERVER}:${ROOTPATH} |
16 | | - fi |
| 1 | +--- 9990-mount-http.sh 2019-06-14 09:55:07.000000000 +0000 |
| 2 | ++++ 9990-mount-http.sh.new 2019-11-15 08:38:03.225447344 +0000 |
| 3 | +@@ -41,7 +41,10 @@ |
17 | 4 |
|
18 | | -- [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}" |
19 | | -- |
20 | | -- if [ "${NETBOOT}" != "nfs" ] && do_cifsmount ; then |
21 | | -- rc=0 |
22 | | -- elif do_nfsmount ; then |
23 | | -- NETBOOT="nfs" |
24 | | -- export NETBOOT |
25 | | -- rc=0 |
26 | | -- fi |
27 | | -+ case ${NETBOOT} in |
28 | | -+ nfs) |
29 | | -+ [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}" |
30 | | -+ if do_nfsmount ; then rc=0; fi ;; |
31 | | -+ cifs) |
32 | | -+ [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}" |
33 | | -+ if do_cifsmount ; then rc=0; fi ;; |
34 | | -+ http) |
35 | | -+ [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${URL}" |
36 | | -+ if do_httpmount ; then rc=0; fi ;; |
37 | | -+ esac |
38 | | - |
39 | | - [ "$quiet" != "y" ] && log_end_msg |
40 | | - return ${rc} |
41 | | - } |
42 | | - |
43 | | -+do_httpmount() { |
44 | | -+ rc=1 |
45 | | -+ mkdir -p ${mountpoint} |
46 | | -+ mount -t tmpfs -o size=`/bin/curl -sI ${URL} | sed -ne '/Content-Length/{s/.*: //;p}'` tmpfs ${mountpoint} |
47 | | -+ mkdir -p ${mountpoint}/casper |
48 | | -+ if /bin/curl -L ${URL} -o ${mountpoint}/casper/root.squashfs; then rc=0; fi |
49 | | -+ if [ ! -z "$(/bin/curl -sI "${URL}".part2 | grep "200 OK\|302 Found" || :)" ]; then |
50 | | -+ if /bin/curl -L ${URL}.part2 -o ->> ${mountpoint}/casper/root.squashfs; then rc=0; fi |
51 | | -+ fi |
52 | | -+ return ${rc} |
53 | | -+} |
54 | | -+ |
55 | | - do_nfsmount() { |
56 | | - rc=1 |
57 | | - modprobe "${MP_QUIET}" nfs |
| 5 | + *) |
| 6 | + log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})" |
| 7 | +- wget "${url}" -O "${dest}/$(basename ${url})" |
| 8 | ++ /bin/curl -L "${url}" -o "${dest}/$(basename ${url})" |
| 9 | ++ if [ ! -z "$(/bin/curl -sI "${url}".part2 | grep "200 OK\|302 Found" || :)" ]; then |
| 10 | ++ /bin/curl -L "${url}".part2 -o ->> "${dest}/$(basename ${url})" |
| 11 | ++ fi |
| 12 | + ;; |
| 13 | + esac |
| 14 | + else |
0 commit comments