Module Name: src
Committed By: martin
Date: Sat Oct 24 16:13:15 UTC 2020
Modified Files:
src/usr.sbin/sysinst: menus.mi msg.mi.de msg.mi.en msg.mi.es msg.mi.fr
msg.mi.pl util.c
Log Message:
When looking for available CD media, skip those that are already mounted.
When no medium with sets is found, show a new error message and return
to the source selection menu.
Rearrange all source option menus to have the proper set suffix
available (either .tgz or .tar.xz).
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/menus.mi
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/msg.mi.en \
src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/sysinst/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/sysinst/menus.mi
diff -u src/usr.sbin/sysinst/menus.mi:1.21 src/usr.sbin/sysinst/menus.mi:1.22
--- src/usr.sbin/sysinst/menus.mi:1.21 Mon Jan 27 21:21:22 2020
+++ src/usr.sbin/sysinst/menus.mi Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: menus.mi,v 1.21 2020/01/27 21:21:22 martin Exp $ */
+/* $NetBSD: menus.mi,v 1.22 2020/10/24 16:13:15 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -362,8 +362,10 @@ menu distset, title MSG_Select_your_dist
menu ftpsource, y=-4, x=0, w=70, no box, no clear,
exitstring MSG_Get_Distribution;
- display action { msg_fmt_display(MSG_ftpsource, "%s",
- url_proto((uintptr_t)((arg_rv*)arg)->arg)); };
+ display action {
+ msg_display_subst(MSG_ftpsource, 2, "." SETS_TAR_SUFF,
+ 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);},
@@ -412,7 +414,8 @@ menu ftpsource, y=-4, x=0, w=70, no box,
menu nfssource, y=-4, x=0, w=70, no box, no clear,
exitstring MSG_Get_Distribution;
- display action { msg_display(MSG_nfssource); };
+ display action { const char suff[] = "." SETS_TAR_SUFF;
+ msg_display_subst(MSG_nfssource, 1, &suff); };
option {src_legend(menu, MSG_Host, nfs_host);},
action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
option {src_legend(menu, MSG_Base_dir, nfs_dir);},
@@ -459,7 +462,8 @@ menu floppysource, y=-4, x=0, w=70, no b
option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
- display action { msg_display(MSG_cdromsource); };
+ display action { const char suff[] = "." SETS_TAR_SUFF;
+ msg_display_subst(MSG_cdromsource, 1, &suff); };
option {src_legend(menu, MSG_Device, cdrom_dev);},
action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
@@ -469,7 +473,8 @@ menu cdromsource, y=-4, x=0, w=70, no bo
option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
- display action { msg_display(MSG_localfssource); };
+ display action { const char suff[] = "." SETS_TAR_SUFF;
+ msg_display_subst(MSG_localfssource, 1, &suff); };
option {src_legend(menu, MSG_Device, localfs_dev);},
action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
option {src_legend(menu, MSG_File_system, localfs_fs);},
@@ -483,7 +488,8 @@ menu localfssource, y=-4, x=0, w=70, no
option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
- display action { msg_display(MSG_localdir); };
+ display action { const char suff[] = "." SETS_TAR_SUFF;
+ msg_display_subst(MSG_localdir, 1, &suff); };
option {src_legend(menu, MSG_Base_dir, localfs_dir);},
action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
Index: src/usr.sbin/sysinst/msg.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.24 src/usr.sbin/sysinst/msg.mi.de:1.25
--- src/usr.sbin/sysinst/msg.mi.de:1.24 Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/msg.mi.de Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.de,v 1.24 2020/10/13 17:26:28 martin Exp $ */
+/* $NetBSD: msg.mi.de,v 1.25 2020/10/24 16:13:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -507,8 +507,12 @@ alle Pakete (volle Installation) zu inst
definierten Satz auszuw�hlen.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ * $1 = URL protocol used ftp
+ */
message ftpsource
-{Dies sind die Daten zum Aufbau einer %s-Verbindung.
+{Dies sind die Daten zum Aufbau einer $1-Verbindung.
Falls der Benutzer "ftp" ist, ben�tigen Sie kein Passwort.
}
@@ -519,10 +523,13 @@ message email
message dev
{Laufwerk}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message nfssource
{Geben Sie den NFS-Server samt Verzeichnis an, auf dem die Distribution zu
finden ist.
-(Das Verzeichnis muss .tgz Dateien enthalten und �ber NFS mountbar sein.)
+(Das Verzeichnis muss $0 Dateien enthalten und �ber NFS mountbar sein.)
}
@@ -533,13 +540,19 @@ Verzeichnis der Diskette liegen.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message cdromsource
{Geben Sie das CD-Laufwerk und das entsprechende Verzeichnis an, in dem
die Distribution zu finden ist.
-(Das Verzeichnis muss .tgz Dateien enthalten.)
+(Das Verzeichnis muss $0 Dateien enthalten.)
}
+message No_cd_found
+{Kein CD Laufwerk enth�lt eine CD mit den Distributions-Dateien!}
+
message Available_cds
{Verf�gbare CDs}
@@ -550,17 +563,23 @@ message cd_path_not_found
{Die Installationsdateien wurden auf der ausgew�hlten CD nicht gefunden. Bitte
pr�fen Sie den Ger�tenamen und Pfad der Installationsdateien.}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localfssource
{Geben Sie das noch nicht gemountete lokale Ger�t und dessen entsprechendes
Verzeichnis an, in dem die Distribution zu finden ist.
-(Das Verzeichnis muss .tgz Dateien enthalten.)
+(Das Verzeichnis muss $0 Dateien enthalten.)
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localdir
{Geben Sie das Verzeichnis des bereits gemounteten lokalen Ger�ts an, in dem
die Distribution zu finden ist.
-(Das Verzeichnis muss .tgz Dateien enthalten.)
+(Das Verzeichnis muss $0 Dateien enthalten.)
}
Index: src/usr.sbin/sysinst/msg.mi.en
diff -u src/usr.sbin/sysinst/msg.mi.en:1.32 src/usr.sbin/sysinst/msg.mi.en:1.33
--- src/usr.sbin/sysinst/msg.mi.en:1.32 Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/msg.mi.en Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.en,v 1.32 2020/10/13 17:26:28 martin Exp $ */
+/* $NetBSD: msg.mi.en,v 1.33 2020/10/24 16:13:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -487,8 +487,12 @@ a core set (Minimal installation), all o
group of sets (Custom installation).
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ * $1 = URL protocol used ftp
+ */
message ftpsource
-{The following are the %s site, directory, user, and password that
+{The following are the $1 site, directory, user, and password that
will be used. If "user" is "ftp", then the password is not needed.
}
@@ -499,9 +503,12 @@ message email
message dev
{device}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message nfssource
{Enter the nfs host and server directory where the distribution is located.
-Remember, the directory should contain the .tgz files and
+Remember, the directory should contain the $0 files and
must be nfs mountable.
}
@@ -512,13 +519,20 @@ file system. The set files must be in t
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message cdromsource
{Enter the CDROM device to be used and directory on the CDROM where
the distribution is located.
-Remember, the directory should contain the .tgz files.
+Remember, the directory should contain the $0 files.
}
+message No_cd_found
+{Could not locate a CD medium in any drive with the distribution sets.
+Check the proper medium and retry!}
+
message Available_cds
{Available CDs }
@@ -529,16 +543,22 @@ message cd_path_not_found
{The installation sets have not been found at the default location on this
CD. Please check the device and path name.}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localfssource
{Enter the unmounted local device and directory on that device where
the distribution is located.
-Remember, the directory should contain the .tgz files.
+Remember, the directory should contain the $0 files.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localdir
{Enter the already-mounted local directory where the distribution is located.
-Remember, the directory should contain the .tgz files.
+Remember, the directory should contain the $0 files.
}
Index: src/usr.sbin/sysinst/msg.mi.pl
diff -u src/usr.sbin/sysinst/msg.mi.pl:1.32 src/usr.sbin/sysinst/msg.mi.pl:1.33
--- src/usr.sbin/sysinst/msg.mi.pl:1.32 Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/msg.mi.pl Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.pl,v 1.32 2020/10/13 17:26:28 martin Exp $ */
+/* $NetBSD: msg.mi.pl,v 1.33 2020/10/24 16:13:15 martin Exp $ */
/* Based on english version: */
/* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */
@@ -480,10 +480,12 @@ takze zainstalowac tylko podstawowy zest
wybrac te, ktore chcesz (Inna instalacja)
}
-
-
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ * $1 = URL protocol used ftp
+ */
message ftpsource
-{Ponizej masz site %s, katalog, uzytkownika, oraz haslo gotowe do uzycia.
+{Ponizej masz site $1, katalog, uzytkownika, oraz haslo gotowe do uzycia.
Jesli "uzytkownik" to "ftp", wtedy haslo nie jest wymagane.
}
@@ -494,9 +496,12 @@ message email
message dev
{urzadzenie}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message nfssource
{Wprowadz hosta NFS oraz katalog gdzie znajduje sie dystrybucja.
-Pamietaj, ze katalog musi zawierac pliki .tgz, oraz musi byc
+Pamietaj, ze katalog musi zawierac pliki $0, oraz musi byc
dostepny przez NFS.
}
@@ -508,13 +513,20 @@ znajdowac sie w glownym katalogu dyskiet
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message cdromsource
{Podaj urzadzenie CDROM oraz katalog na CDROMie, w ktorym znajduje sie
dystrybucja.
-Pamietaj, ze katalog musi zawierac pliki .tgz.
+Pamietaj, ze katalog musi zawierac pliki $0.
}
+message No_cd_found
+{Could not locate a CD medium in any drive with the distribution sets.
+Check the proper medium and retry!}
+
message Available_cds
{Dostepne napedy CD}
@@ -526,16 +538,22 @@ message cd_path_not_found
{Zbiory instalacyjne nie zostaly znalezione w domyslnym polozeniu na tym
CD. Prosze sprawdzic urzadzenie i sciezke.}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localfssource
{Podaj niezamontowane lokalne urzadzenie oraz katalog na nim, gdzie
znajduje sie dystrybucja.
-Pamietaj, ze katalog musi zawierac pliki .tgz.
+Pamietaj, ze katalog musi zawierac pliki $0.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localdir
{Podaj aktualnie zamontowany lokalny katalog, gdzie znajduje sie dystrybucja.
-Pamietaj, ze katalog musi zawierac pliki .tgz.
+Pamietaj, ze katalog musi zawierac pliki $0.
}
Index: src/usr.sbin/sysinst/msg.mi.es
diff -u src/usr.sbin/sysinst/msg.mi.es:1.26 src/usr.sbin/sysinst/msg.mi.es:1.27
--- src/usr.sbin/sysinst/msg.mi.es:1.26 Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/msg.mi.es Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.es,v 1.26 2020/10/13 17:26:28 martin Exp $ */
+/* $NetBSD: msg.mi.es,v 1.27 2020/10/24 16:13:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -502,8 +502,12 @@ instalaciones. Puede escoger para insta
seleccionar de entre los conjuntos de distribuci�n opcionales.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ * $1 = URL protocol used ftp
+ */
message ftpsource
-{Lo siguiente son el sitio %s, directorio, usuario y contrase�a que se
+{Lo siguiente son el sitio $1, directorio, usuario y contrase�a que se
usar�n. Si �usuario� es �ftp�, no se necesita contrase�a..
}
@@ -514,9 +518,12 @@ message email
message dev
{dispositivo}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message nfssource
{Introduzca el servidor nfs y el directorio del servidor donde se encuentre
-la distribuci�n. Recuerde: el directorio debe contener los archivos .tgz y
+la distribuci�n. Recuerde: el directorio debe contener los archivos $0 y
debe ser montable por nfs.
}
@@ -528,13 +535,20 @@ en el directorio ra�z de los disquetes.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message cdromsource
{Introduzca el dispositivo de CDROM a usar y el directorio del CDROM
donde se encuentre la distribuci�n.
-Recuerde, el directorio debe contener los archivos .tgz.
+Recuerde, el directorio debe contener los archivos $0.
}
+message No_cd_found
+{Could not locate a CD medium in any drive with the distribution sets.
+Check the proper medium and retry!}
+
message Available_cds
{Available CDs}
@@ -545,16 +559,22 @@ message cd_path_not_found
{The installation sets have not been found at the default location on this
CD. Please check device and path name.}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localfssource
{Introduzca el dispositivo local desmontado y el directorio de ese
dispositivo donde se encuentre la distribuci�n.
-Recuerde, el directorio debe contener los archivos .tgz.
+Recuerde, el directorio debe contener los archivos $0.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ */
message localdir
{Introduzca el directorio local ya montado donde se encuentre la distribuci�n.
-Recuerde, el directorio debe contener los archivos .tgz.
+Recuerde, el directorio debe contener los archivos $0.
}
Index: src/usr.sbin/sysinst/msg.mi.fr
diff -u src/usr.sbin/sysinst/msg.mi.fr:1.31 src/usr.sbin/sysinst/msg.mi.fr:1.32
--- src/usr.sbin/sysinst/msg.mi.fr:1.31 Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/msg.mi.fr Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.fr,v 1.31 2020/10/13 17:26:28 martin Exp $ */
+/* $NetBSD: msg.mi.fr,v 1.32 2020/10/24 16:13:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -498,13 +498,17 @@ Trois types d'installations vous sont pr
personnalis�e.
}
+/* Called with: Example
+ * $0 = sets suffix .tgz
+ * $1 = URL protocol used ftp
+ */
message ftpsource
-{Voici la configuration actuelle pour : nom du site (%s), r�pertoire, nom
+{Voici la configuration actuelle pour : nom du site ($1), r�pertoire, nom
d'utilisateur et mot de passe.
Si vous utilisez le mode FTP, le mot de passe n'est pas requis.
Le r�pertoire contenant les composants doit �tre d�fini par
rapport au r�pertoire de base, et contenir chaque composant sous
-la forme de fichiers .tgz
+la forme de fichiers $0
}
@@ -537,6 +541,9 @@ tgz.
}
+message No_cd_found
+{Could not locate a CD medium in any drive with the distribution sets.
+Check the proper medium and retry!}
message Available_cds
{CD-ROM disponibles}
Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.48 src/usr.sbin/sysinst/util.c:1.49
--- src/usr.sbin/sysinst/util.c:1.48 Tue Oct 13 17:26:28 2020
+++ src/usr.sbin/sysinst/util.c Sat Oct 24 16:13:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.48 2020/10/13 17:26:28 martin Exp $ */
+/* $NetBSD: util.c,v 1.49 2020/10/24 16:13:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -419,6 +419,8 @@ get_iso9660_volname(int dev, int sess, c
* Local state while iterating CDs and collecting volumes
*/
struct get_available_cds_state {
+ size_t num_mounted;
+ struct statvfs *mounted;
struct cd_info *info;
size_t count;
};
@@ -430,14 +432,26 @@ static bool
get_available_cds_helper(void *arg, const char *device)
{
struct get_available_cds_state *state = arg;
- char dname[16], volname[80];
+ char dname[16], tname[16], volname[80], *t;
struct disklabel label;
- int part, dev, error, sess, ready;
+ int part, dev, error, sess, ready, tlen;
if (!is_cdrom_device(device, false))
return true;
sprintf(dname, "/dev/r%s%c", device, 'a'+RAW_PART);
+ tlen = sprintf(tname, "/dev/%s", device);
+
+ /* check if this is mounted already */
+ for (size_t i = 0; i < state->num_mounted; i++) {
+ if (strncmp(state->mounted[i].f_mntfromname, tname, tlen)
+ == 0) {
+ t = state->mounted[i].f_mntfromname + tlen;
+ if (t[0] >= 'a' && t[0] <= 'z' && t[1] == 0)
+ return true;
+ }
+ }
+
dev = open(dname, O_RDONLY, 0);
if (dev == -1)
return true;
@@ -501,12 +515,24 @@ static int
get_available_cds(void)
{
struct get_available_cds_state data;
+ int n, e;
+ memset(&data, 0, sizeof data);
data.info = cds;
- data.count = 0;
+
+ n = getvfsstat(NULL, 0, ST_NOWAIT);
+ if (n > 0) {
+ data.mounted = calloc(n, sizeof(*data.mounted));
+ e = getvfsstat(data.mounted, n*sizeof(*data.mounted),
+ ST_NOWAIT);
+ assert(e == n);
+ data.num_mounted = n;
+ }
enumerate_disks(&data, get_available_cds_helper);
+ free(data.mounted);
+
return data.count;
}
@@ -590,7 +616,8 @@ get_via_cdrom(void)
memset(cd_menu, 0, sizeof(cd_menu));
num_cds = get_available_cds();
if (num_cds <= 0) {
- silent = true;
+ hit_enter_to_continue(MSG_No_cd_found, NULL);
+ return SET_RETRY;
} else if (num_cds == 1) {
/* single CD found, check for sets on it */
strcpy(cdrom_dev, cds[0].device_name);