Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Split the host name used for ftp transfers ...



details:   https://anonhg.NetBSD.org/src/rev/a4ac99c4a682
branches:  trunk
changeset: 993439:a4ac99c4a682
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Sep 11 08:05:18 2018 +0000

description:
Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).

diffstat:

 usr.sbin/sysinst/defs.h    |  23 +++++++++++++++++++----
 usr.sbin/sysinst/main.c    |  13 ++++++++-----
 usr.sbin/sysinst/menus.mi  |  26 +++++++++++++++-----------
 usr.sbin/sysinst/msg.mi.de |   3 ++-
 usr.sbin/sysinst/msg.mi.en |   3 ++-
 usr.sbin/sysinst/msg.mi.es |   3 ++-
 usr.sbin/sysinst/msg.mi.fr |   3 ++-
 usr.sbin/sysinst/msg.mi.pl |   3 ++-
 usr.sbin/sysinst/net.c     |  23 +++++++++++++++++------
 9 files changed, 69 insertions(+), 31 deletions(-)

diffs (truncated from 341 to 300 lines):

diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/defs.h   Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.15 2018/09/08 20:01:19 martin Exp $ */
+/*     $NetBSD: defs.h,v 1.16 2018/09/11 08:05:18 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -340,6 +340,10 @@
 #define SYSINST_FTP_HOST       "ftp.NetBSD.org"
 #endif
 
+#if !defined(SYSINST_HTTP_HOST)
+#define SYSINST_HTTP_HOST      "cdn.NetBSD.org"
+#endif
+
 #if !defined(SYSINST_FTP_DIR)
 #if defined(NETBSD_OFFICIAL_RELEASE)
 #define SYSINST_FTP_DIR                "pub/NetBSD/NetBSD-" REL
@@ -355,6 +359,9 @@
 #if !defined(SYSINST_PKG_HOST)
 #define SYSINST_PKG_HOST       "ftp.NetBSD.org"
 #endif
+#if !defined(SYSINST_PKG_HTTP_HOST)
+#define SYSINST_PKG_HTTP_HOST  "cdn.NetBSD.org"
+#endif
 
 #if !defined(SYSINST_PKG_DIR)
 #define SYSINST_PKG_DIR                "pub/pkgsrc/packages/NetBSD"
@@ -363,6 +370,9 @@
 #if !defined(SYSINST_PKGSRC_HOST)
 #define SYSINST_PKGSRC_HOST    SYSINST_PKG_HOST
 #endif
+#if !defined(SYSINST_PKGSRC_HTTP_HOST)
+#define SYSINST_PKGSRC_HTTP_HOST       SYSINST_PKG_HTTP_HOST
+#endif
 
 /* Abs. path we extract binary sets from */
 char ext_dir_bin[STRSIZE];
@@ -388,13 +398,17 @@
 /* User shell */
 const char *ushell;
 
+#define        XFER_FTP        0
+#define        XFER_HTTP       1
+#define        XFER_MAX        XFER_HTTP
+
 struct ftpinfo {
-    char host[STRSIZE];
+    char xfer_host[XFER_MAX+1][STRSIZE];
     char dir[STRSIZE] ;
     char user[SSTRSIZE];
     char pass[STRSIZE];
     char proxy[STRSIZE];
-    const char *xfer_type;             /* "ftp" or "http" */
+    unsigned int xfer; /* XFER_FTP for "ftp" or XFER_HTTP for "http" */
 };
 
 /* use the same struct for sets ftp and to build pkgpath */
@@ -500,12 +514,13 @@
 /* from net.c */
 extern int network_up;
 extern char net_namesvr[STRSIZE];
-int    get_via_ftp(const char *);
+int    get_via_ftp(unsigned int);
 int    get_via_nfs(void);
 int    config_network(void);
 void   mnt_net_config(void);
 void   make_url(char *, struct ftpinfo *, const char *);
 int    get_pkgsrc(void);
+const char *url_proto(unsigned int);
 
 /* From run.c */
 int    collect(int, char **, const char *, ...) __printflike(3, 4);
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/main.c
--- a/usr.sbin/sysinst/main.c   Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/main.c   Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.7 2017/05/04 16:26:10 sevan Exp $   */
+/*     $NetBSD: main.c,v 1.8 2018/09/11 08:05:18 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -91,7 +91,8 @@
        {"xfer dir", "/usr/INSTALL", xfer_dir, sizeof xfer_dir},
        {"ext dir", "", ext_dir_bin, sizeof ext_dir_bin},
        {"ext src dir", "", ext_dir_src, sizeof ext_dir_src},
-       {"ftp host", SYSINST_FTP_HOST, ftp.host, sizeof ftp.host},
+       {"ftp host", SYSINST_FTP_HOST, ftp.xfer_host[XFER_FTP], sizeof ftp.xfer_host[XFER_FTP]},
+       {"http host", SYSINST_HTTP_HOST, ftp.xfer_host[XFER_HTTP], sizeof ftp.xfer_host[XFER_HTTP]},
        {"ftp dir", SYSINST_FTP_DIR, ftp.dir, sizeof ftp.dir},
        {"ftp prefix", "/" MACH "/binary/sets", set_dir_bin, sizeof set_dir_bin},
        {"ftp src prefix", "/source/sets", set_dir_src, sizeof set_dir_src},
@@ -108,13 +109,15 @@
        {"targetroot mount", "/targetroot", targetroot_mnt, sizeof targetroot_mnt},
        {"dist postfix", ".tgz", dist_postfix, sizeof dist_postfix},
        {"diskname", "mydisk", bsddiskname, sizeof bsddiskname},
-       {"pkg host", SYSINST_PKG_HOST, pkg.host, sizeof pkg.host},
+       {"pkg host", SYSINST_PKG_HOST, pkg.xfer_host[XFER_FTP], sizeof pkg.xfer_host[XFER_FTP]},
+       {"pkg http host", SYSINST_PKG_HTTP_HOST, pkg.xfer_host[XFER_HTTP], sizeof pkg.xfer_host[XFER_HTTP]},
        {"pkg dir", SYSINST_PKG_DIR, pkg.dir, sizeof pkg.dir},
        {"pkg prefix", "/" MACH "/" REL "/All", pkg_dir, sizeof pkg_dir},
        {"pkg user", "ftp", pkg.user, sizeof pkg.user},
        {"pkg pass", "", pkg.pass, sizeof pkg.pass},
        {"pkg proxy", "", pkg.proxy, sizeof pkg.proxy},
-       {"pkgsrc host", SYSINST_PKGSRC_HOST, pkgsrc.host, sizeof pkgsrc.host},
+       {"pkgsrc host", SYSINST_PKGSRC_HOST, pkgsrc.xfer_host[XFER_FTP], sizeof pkgsrc.xfer_host[XFER_FTP]},
+       {"pkgsrc http host", SYSINST_PKGSRC_HTTP_HOST, pkgsrc.xfer_host[XFER_HTTP], sizeof pkgsrc.xfer_host[XFER_HTTP]},
        {"pkgsrc dir", "", pkgsrc.dir, sizeof pkgsrc.dir},
        {"pkgsrc prefix", "pub/pkgsrc/stable", pkgsrc_dir, sizeof pkgsrc_dir},
        {"pkgsrc user", "ftp", pkgsrc.user, sizeof pkgsrc.user},
@@ -149,7 +152,7 @@
                        strlcpy(arg->var, arg->dflt, arg->size);
        }
        strlcpy(pm_new->bsddiskname, bsddiskname, sizeof pm_new->bsddiskname);
-       pkg.xfer_type = pkgsrc.xfer_type = "http";
+       pkg.xfer = pkgsrc.xfer = XFER_HTTP;
        
        clr_arg.bg=COLOR_BLUE;
        clr_arg.fg=COLOR_WHITE;
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/menus.mi
--- a/usr.sbin/sysinst/menus.mi Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/menus.mi Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menus.mi,v 1.13 2018/06/03 13:23:58 martin Exp $       */
+/*     $NetBSD: menus.mi,v 1.14 2018/09/11 08:05:18 martin Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -327,8 +327,8 @@
 
 menu distmedium, title MSG_Select_medium, y=-5;
        option MSG_cdrom,     exit, action { *(int *)arg = get_via_cdrom(); };
-       option MSG_http,      exit, action { *(int *)arg = get_via_ftp("http"); };
-       option MSG_ftp,       exit, action { *(int *)arg = get_via_ftp("ftp"); };
+       option MSG_http,      exit, action { *(int *)arg = get_via_ftp(XFER_HTTP); };
+       option MSG_ftp,       exit, action { *(int *)arg = get_via_ftp(XFER_FTP); };
        option MSG_nfs,       exit, action { *(int *)arg = get_via_nfs(); };
        option MSG_floppy,    exit, action { *(int *)arg = get_via_floppy(); };
        option MSG_local_fs,  exit, action { *(int *)arg = get_via_localfs(); };
@@ -347,9 +347,9 @@
 
 menu ftpsource, y=-4, x=0, w=70, no box, no clear,
            exitstring MSG_Get_Distribution;
-       display action { msg_display(MSG_ftpsource, ((arg_rv*)arg)->arg); };
-       option {src_legend(menu, MSG_Host, ftp.host);},
-               action { src_prompt(MSG_Host, ftp.host, sizeof ftp.host); };
+       display action { msg_display(MSG_ftpsource, url_proto((uintptr_t)((arg_rv*)arg)->arg)); };
+       option {src_legend(menu, MSG_Host, ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg]);},
+               action { src_prompt(MSG_Host, ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg], sizeof ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg]); };
        option {src_legend(menu, MSG_Base_dir, ftp.dir);},
                action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
        option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
@@ -533,8 +533,8 @@
 menu binpkg, y=-4, x=0, w=70, no box, no clear,
            exitstring MSG_Install_pkgin;
        display action { msg_display(MSG_pkgpath); };
-       option {src_legend(menu, MSG_Host, pkg.host);},
-               action { src_prompt(MSG_Host, pkg.host, sizeof pkg.host); };
+       option {src_legend(menu, MSG_Host, pkg.xfer_host[pkg.xfer]);},
+               action { src_prompt(MSG_Host, pkg.xfer_host[pkg.xfer], sizeof pkg.xfer_host[pkg.xfer]); };
        option {src_legend(menu, MSG_Base_dir, pkg.dir);},
                action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
        option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
@@ -573,14 +573,16 @@
                        config_network();
                        mnt_net_config();
                };
+       option {src_legend(menu, MSG_transfer_method, url_proto(pkg.xfer));},
+               action { pkg.xfer = (pkg.xfer+1) % (XFER_MAX+1); };
        option MSG_quit_pkgs_install, exit, action { ((arg_rv*)arg)->rv = SET_SKIP; };
 
 menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
            exit, exitstring MSG_Install_pkgsrc;
        display action { msg_display(MSG_pkgsrc); };
-       option {src_legend(menu, MSG_Host, pkgsrc.host);},
-               action { src_prompt(MSG_Host, pkgsrc.host,
-                       sizeof pkgsrc.host); };
+       option {src_legend(menu, MSG_Host, pkgsrc.xfer_host[pkgsrc.xfer]);},
+               action { src_prompt(MSG_Host, pkgsrc.xfer_host[pkgsrc.xfer],
+                       sizeof pkgsrc.xfer_host[pkgsrc.xfer]); };
        option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
                action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
        option {src_legend(menu, MSG_User, pkgsrc.user);},
@@ -612,6 +614,8 @@
        option {src_legend(menu, MSG_delete_xfer_file,
                        clean_xfer_dir ? MSG_Yes : MSG_No);},
                action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
+       option {src_legend(menu, MSG_transfer_method, url_proto(pkgsrc.xfer));},
+               action { pkgsrc.xfer = (pkgsrc.xfer+1) % (XFER_MAX+1); };
        option MSG_quit_pkgsrc, exit, action { *((int*)arg) = SET_SKIP;};
 
 menu usersh, title MSG_User_shell, no clear;
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/msg.mi.de
--- a/usr.sbin/sysinst/msg.mi.de        Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/msg.mi.de        Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.de,v 1.7 2018/06/03 13:16:30 martin Exp $       */
+/*     $NetBSD: msg.mi.de,v 1.8 2018/09/11 08:05:18 martin Exp $       */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -988,6 +988,7 @@
 message Set_dir_bin {Binärpaket-Verzeichnis}
 message Set_dir_src {Quelltext-Verzeichnis}
 message Xfer_dir {Zwischenspeicher}
+message transfer_method {Download via}
 message User {Benutzer}
 message Password {Passwort}
 message Proxy {Proxy}
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/msg.mi.en
--- a/usr.sbin/sysinst/msg.mi.en        Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/msg.mi.en        Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.en,v 1.11 2018/06/03 13:16:30 martin Exp $      */
+/*     $NetBSD: msg.mi.en,v 1.12 2018/09/11 08:05:18 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -923,6 +923,7 @@
 message Set_dir_bin {Binary set directory}
 message Set_dir_src {Source set directory}
 message Xfer_dir {Transfer directory}
+message transfer_method {Download via}
 message User {User}
 message Password {Password}
 message Proxy {Proxy}
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/msg.mi.es
--- a/usr.sbin/sysinst/msg.mi.es        Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/msg.mi.es        Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.es,v 1.7 2018/06/03 13:16:30 martin Exp $       */
+/*     $NetBSD: msg.mi.es,v 1.8 2018/09/11 08:05:18 martin Exp $       */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -954,6 +954,7 @@
 message Set_dir_src {Directorio de conjuntos binary} /* fix XLAT */
 message Set_dir_bin {Directorio de conjuntos source} /* fix XLAT */
 message Xfer_dir {Directorio a transferir a}
+message transfer_method {Download via}
 message User {Usuario}
 message Password {Contraseña}
 message Proxy {Proxy}
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/msg.mi.fr
--- a/usr.sbin/sysinst/msg.mi.fr        Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/msg.mi.fr        Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.fr,v 1.10 2018/06/03 13:16:30 martin Exp $      */
+/*     $NetBSD: msg.mi.fr,v 1.11 2018/09/11 08:05:18 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1023,6 +1023,7 @@
 message Set_dir_bin {Répertoire des composants binaire}
 message Set_dir_src {Répertoire des composants source}
 message Xfer_dir {Répertoire de transfert}
+message transfer_method {Download via}
 message User {Utilisateur}
 message Password {Mot de passe}
 message Proxy {Proxy}
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/msg.mi.pl
--- a/usr.sbin/sysinst/msg.mi.pl        Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/msg.mi.pl        Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.pl,v 1.9 2018/06/03 13:16:30 martin Exp $       */
+/*     $NetBSD: msg.mi.pl,v 1.10 2018/09/11 08:05:18 martin Exp $      */
 /*     Based on english version: */
 /*     NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp       */
 
@@ -926,6 +926,7 @@
 message Set_dir_src {Katalog pakiet binary} /* fix XLAT */
 message Set_dir_bin {Katalog pakiet source} /* fix XLAT */
 message Xfer_dir {Transfer Katalog} /* fix XLAT */
+message transfer_method {Download via}
 message User {Uzytkownik}
 message Password {Haslo}
 message Proxy {Proxy}
diff -r 3349cf832df4 -r a4ac99c4a682 usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Tue Sep 11 03:30:40 2018 +0000
+++ b/usr.sbin/sysinst/net.c    Tue Sep 11 08:05:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.24 2018/05/18 12:23:22 joerg Exp $   */
+/*     $NetBSD: net.c,v 1.25 2018/09/11 08:05:18 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -849,6 +849,17 @@
        return network_up;
 }
 
+const char *
+url_proto(unsigned int xfer)
+{
+       switch (xfer) {
+       case XFER_FTP:  return "ftp";
+       case XFER_HTTP: return "http";
+       }
+



Home | Main Index | Thread Index | Old Index