Source-Changes-HG archive

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

[src/trunk]: src/distrib/miniroot Fetch files via ftp using auto-fetching wit...



details:   https://anonhg.NetBSD.org/src/rev/9f1dda68f90d
branches:  trunk
changeset: 957813:9f1dda68f90d
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Dec 12 05:23:21 2020 +0000

description:
Fetch files via ftp using auto-fetching with URL per each binary set.

On slower machines, it takes more than five minutes to get a large
set binary and it could cause timeout of ftp control session, so
getting multiple binary sets in a single ftp session always fails.

Briefly tested on HP 9000/425e with 9.1 tree and ftp.netbsd.org binaries.
No particular comments on tech-install@ and port-hp300@.

Maybe should be pulled up to netbsd-9.

diffstat:

 distrib/miniroot/install.sub |  32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diffs (68 lines):

diff -r 3cad370b87df -r 9f1dda68f90d distrib/miniroot/install.sub
--- a/distrib/miniroot/install.sub      Sat Dec 12 03:03:14 2020 +0000
+++ b/distrib/miniroot/install.sub      Sat Dec 12 05:23:21 2020 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $NetBSD: install.sub,v 1.58 2020/12/05 18:57:21 tsutsui Exp $
+#      $NetBSD: install.sub,v 1.59 2020/12/12 05:23:21 tsutsui Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -725,6 +725,15 @@
                fi
        done
        rm -f /tmp/ftp-dir.sh /tmp/fname_filter.sh
+       rm -f /tmp/ftp-script.sh
+
+       # Prepare ftp-fetch script to fetch binary sets
+       _download_dir=INSTALL
+       _ftp_opts=""
+       _ftp_url="ftp://$_ftp_server_login:$_ftp_server_password@$_ftp_server_ip$_ftp_server_dir/";
+       echo "#!/bin/sh" > /tmp/ftp-fetch.sh
+       echo "cd /mnt" >> /tmp/ftp-fetch.sh
+       echo "mkdir -p $_download_dir" >> /tmp/ftp-fetch.sh
 
        while : ; do
                echo "The following sets are available for extraction:"
@@ -745,7 +754,7 @@
                echo ""
 
                # Get name of the file and add extraction command
-               # to the ftp-script.
+               # to the ftp-fetch script.
                if [ -z "$_next" ]; then resp=n; else resp=y; fi
                echo -n "Continue to add filenames [$resp]? "
                getresp "$resp"
@@ -756,8 +765,16 @@
                echo -n "File name [$_next]? "
                getresp "$_next"
                if isin $resp $_sets; then
-                       echo "get $resp |\"pax -zr${verbose_flag}pe\"" >> \
-                                       /tmp/ftp-script.sh
+                       echo "echo Fetching $resp:" >> \
+                                       /tmp/ftp-fetch.sh
+                       echo "ftp ${_ftp_opts} -o $_download_dir/$resp ${_ftp_url}$resp" >> \
+                                       /tmp/ftp-fetch.sh
+                       echo "echo Extracting $resp:" >> \
+                                       /tmp/ftp-fetch.sh
+                       echo "pax -zr${verbose_flag}pe -f $_download_dir/$resp" >> \
+                                       /tmp/ftp-fetch.sh
+                       echo "rm -f $_download_dir/$resp" >> \
+                                       /tmp/ftp-fetch.sh
                        _setsdone="$resp $_setsdone"
                else
                        echo "You entered an invalid filename."
@@ -765,11 +782,8 @@
                fi
        done
 
-       echo "quit" >> /tmp/ftp-script.sh
-       echo "__end_commands" >> /tmp/ftp-script.sh
-
-       sh /tmp/ftp-script.sh
-       rm -f /tmp/ftp-script.sh
+       sh /tmp/ftp-fetch.sh
+       rm -f /tmp/ftp-fetch.sh
        echo "Extraction complete."
 }
 



Home | Main Index | Thread Index | Old Index