shithub: riscv

Download patch

ref: 2559f92a83d2a04000fb1a0d392c6e2597758b11
parent: 41372f346ae5636e59284ff698d8202e8301641f
author: cinap_lenrek <[email protected]>
date: Mon Jul 13 02:28:46 EDT 2015

inst: fix download task using ip/httpfile to mount a iso over http and prompt for installurl

--- a/rc/bin/inst/download
+++ b/rc/bin/inst/download
@@ -18,27 +18,23 @@
 	}
 
 case go
-	# BUG make restartable
-	echo 'Downloading distribution package...'
-	baropt='-w 145,129,445,168'
-	if(~ $textinst 1)
-		baropt=-t
-	mkdir -p /n/newfs/dist
-	if(! hget -vo /n/newfs/dist/_9front.iso.bz2 $installurl/9front.iso.bz2 |[2] aux/statusbar $baropt 'downloading '^9front.iso.bz2)
-			exit
-	mv /n/newfs/dist/_9front.iso.bz2 /n/newfs/dist/9front.iso.bz2
+	default=()
+	if(~ $#installurl 1)
+		default=(-d $installurl)
+	prompt $default 'Installation url'
+	installurl=$rd
 
-	echo 'The distribution is downloaded.'
+	if(! test -e /mnt/web/ctl)
+		webfs
 
-	srvmedia=()
-	mountmedia=(mount /srv/cwfs /n/distmedia)
-	distmediadir=/dist
-	export distmediadir mountmedia distmedia
+	srvmedia=(ip/httpfile -s httpdist $installurl/9front.iso)
+	mountmedia=(mount /srv/httpdist /n/distmedia)
+	distmediadir=/
+	export srvmedia mountmedia distmediadir
 	
 case checkdone
-	if(! test -f /n/newfs/dist/9front.iso.bz2) {
+	if(! test -f /n/distmedia/9front.iso) {
 		download=notdone
 		export download
 	}
 }
-
--- a/rc/bin/inst/mountdist
+++ b/rc/bin/inst/mountdist
@@ -22,7 +22,7 @@
 fn trycdimage{
 	if(test -f $1){
 		rm -f /srv/9660.dist
-		unmount /n/dist
+		unmount /n/dist >[2]/dev/null
 		9660srv 9660.dist >[2]/dev/null
 		logprog mount /srv/9660.dist /n/dist $1
 		exitifdone
@@ -34,6 +34,7 @@
 
 fn trycdimagebz2 {
 	if(test -f $1){
+		mkdir -p /n/newfs/dist
 		echo -n 'bunzip2 < '^$1^' >/n/newfs/dist/9front.iso'
 		bunzip2 < $1 >/n/newfs/dist/_9front.iso &&
 		mv /n/newfs/dist/_9front.iso /n/newfs/dist/9front.iso