From 7140b4def8be48c12114b1cc16300ae0d2c1b86d Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Tue, 29 Feb 2000 10:40:59 +0000 Subject: [PATCH] o Add support for loading the rsaref or rsaintl packages, depending on locale. o Allow use of "G" in label editor to stand for gigabytes. This is actually an unrelated patch which I meant to commit separately but what the heck, it's late. Partially submitted by: phk --- release/sysinstall/disks.c | 4 ++++ release/sysinstall/globals.c | 2 ++ release/sysinstall/install.c | 29 +++++++++++++++++++++++++++++ release/sysinstall/label.c | 7 +++++-- release/sysinstall/package.c | 3 ++- release/sysinstall/sysinstall.h | 4 +++- usr.sbin/sade/disks.c | 4 ++++ usr.sbin/sade/globals.c | 2 ++ usr.sbin/sade/install.c | 29 +++++++++++++++++++++++++++++ usr.sbin/sade/label.c | 7 +++++-- usr.sbin/sade/sade.h | 4 +++- usr.sbin/sysinstall/disks.c | 4 ++++ usr.sbin/sysinstall/globals.c | 2 ++ usr.sbin/sysinstall/install.c | 29 +++++++++++++++++++++++++++++ usr.sbin/sysinstall/label.c | 7 +++++-- usr.sbin/sysinstall/package.c | 3 ++- usr.sbin/sysinstall/sysinstall.h | 4 +++- 17 files changed, 133 insertions(+), 11 deletions(-) diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c index 2a611b927e89..16be5e2f13f5 100644 --- a/release/sysinstall/disks.c +++ b/release/sysinstall/disks.c @@ -309,6 +309,8 @@ diskPartition(Device *dev) if (val && (size = strtol(val, &cp, 0)) > 0) { if (*cp && toupper(*cp) == 'M') size *= ONE_MEG; + else if (*cp && toupper(*cp) == 'G') + size *= ONE_GIG; strcpy(tmp, "165"); val = msgGetInput(tmp, "Enter type of partition to create:\n\n" "Pressing Enter will choose the default, a native FreeBSD\n" @@ -733,6 +735,8 @@ diskPartitionNonInteractive(Device *dev) /* Look for sz bytes free */ if (*cp && toupper(*cp) == 'M') sz *= ONE_MEG; + else if (*cp && toupper(*cp) == 'G') + sz *= ONE_GIG; for (i = 0; chunk_info[i]; i++) { /* If a chunk is at least sz MB, use it. */ if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) { diff --git a/release/sysinstall/globals.c b/release/sysinstall/globals.c index c47c3a048338..9b66fab2180f 100644 --- a/release/sysinstall/globals.c +++ b/release/sysinstall/globals.c @@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ +Boolean PkgInteractive; /* Is the package going to spew at us? */ Boolean USAResident; /* Are we cryptographically challenged? */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ @@ -63,6 +64,7 @@ globalsInit(void) { DebugFD = -1; ColorDisplay = FALSE; + PkgInteractive = FALSE; Fake = FALSE; OnVTY = FALSE; DialogActive = FALSE; diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index 83972b0cec35..7c271389d0fa 100644 --- a/release/sysinstall/install.c +++ b/release/sysinstall/install.c @@ -565,6 +565,35 @@ nodisks: (void)configLinux(self); #endif + dialog_clear(); + if (USAResident) { + if (!msgYesNo("I see that you are \"USA_RESIDENT\" according to your earlier\n" + "response to the CRYPTO distribution dialog. Do you want to try and\n" + "load the rsaref package from the current media? Some restrictions on\n" + "usage may apply, so be sure to read the package installation output!")) { + PkgInteractive = TRUE; + dialog_clear(); + if (DITEM_STATUS(package_add("rsaref")) != DITEM_SUCCESS) { + msgConfirm("Unable to find an rsaref package on the current intallation media.\n" + "You may wish to switch media types and try again, perhaps\n" + "from an FTP server which carries this package."); + } + PkgInteractive = FALSE; + dialog_clear(); + } + } + else { + if (!msgYesNo("I see that you are not \"USA_RESIDENT\" according to your earlier\n" + "response to the CRYPTO distribution dialog. Do you want to try and\n" + "load the rsaintl package from the current media?")) { + if (DITEM_STATUS(package_add("rsaintl")) != DITEM_SUCCESS) { + msgConfirm("Unable to find an rsaintl package on the current intallation media.\n" + "You may wish to switch media types and try again, perhaps\n" + "from an FTP server which carries this package."); + } + } + } + dialog_clear_norefresh(); if (!msgYesNo("Does this system have a mouse attached to it?")) dmenuOpenSimple(&MenuMouse, FALSE); diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c index bce434ebb6f9..460f19404d2a 100644 --- a/release/sysinstall/label.c +++ b/release/sysinstall/label.c @@ -901,8 +901,9 @@ diskLabel(Device *dev) sprintf(osize, "%d", sz); val = msgGetInput(osize, - "Please specify the partition size in blocks or append a trailing M for\n" - "megabytes or C for cylinders. %d blocks (%dMB) are free.", + "Please specify the partition size in blocks or append a trailing G for\n" + "gigabytes, M for megabytes, or C for cylinders.\n" + "%d blocks (%dMB) are free.", sz, sz / ONE_MEG); if (!val || (size = strtol(val, &cp, 0)) <= 0) { clear_wins(); @@ -912,6 +913,8 @@ diskLabel(Device *dev) if (*cp) { if (toupper(*cp) == 'M') size *= ONE_MEG; + else if (toupper(*cp) == 'G') + size *= ONE_GIG; else if (toupper(*cp) == 'C') size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect); } diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index 8901d08b998a..1959df74a4cf 100644 --- a/release/sysinstall/package.c +++ b/release/sysinstall/package.c @@ -167,7 +167,8 @@ package_extract(Device *dev, char *name, Boolean depended) pid = fork(); if (!pid) { dup2(pfd[0], 0); close(pfd[0]); - dup2(DebugFD, 1); + if (!PkgInteractive) + dup2(DebugFD, 1); close(2); close(pfd[1]); if (isDebug()) diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index a07d4fef13ca..2d3bf6f05158 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -174,6 +174,7 @@ /* One MB worth of blocks */ #define ONE_MEG 2048 +#define ONE_GIG (ONE_MEG * 1024) /* Which selection attributes to use */ #define ATTR_SELECTED (ColorDisplay ? item_selected_attr : item_attr) @@ -340,7 +341,8 @@ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ -Boolean USAResident; /* Are we cryptographically challenged? */ +Boolean PkgInteractive; /* Is the package going to spew at us? */ +Boolean USAResident; /* Are we cryptographically challenged? */ extern Variable *VarHead; /* The head of the variable chain */ extern Device *mediaDevice; /* Where we're getting our distribution from */ extern unsigned int Dists; /* Which distributions we want */ diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index 2a611b927e89..16be5e2f13f5 100644 --- a/usr.sbin/sade/disks.c +++ b/usr.sbin/sade/disks.c @@ -309,6 +309,8 @@ diskPartition(Device *dev) if (val && (size = strtol(val, &cp, 0)) > 0) { if (*cp && toupper(*cp) == 'M') size *= ONE_MEG; + else if (*cp && toupper(*cp) == 'G') + size *= ONE_GIG; strcpy(tmp, "165"); val = msgGetInput(tmp, "Enter type of partition to create:\n\n" "Pressing Enter will choose the default, a native FreeBSD\n" @@ -733,6 +735,8 @@ diskPartitionNonInteractive(Device *dev) /* Look for sz bytes free */ if (*cp && toupper(*cp) == 'M') sz *= ONE_MEG; + else if (*cp && toupper(*cp) == 'G') + sz *= ONE_GIG; for (i = 0; chunk_info[i]; i++) { /* If a chunk is at least sz MB, use it. */ if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) { diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c index c47c3a048338..9b66fab2180f 100644 --- a/usr.sbin/sade/globals.c +++ b/usr.sbin/sade/globals.c @@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ +Boolean PkgInteractive; /* Is the package going to spew at us? */ Boolean USAResident; /* Are we cryptographically challenged? */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ @@ -63,6 +64,7 @@ globalsInit(void) { DebugFD = -1; ColorDisplay = FALSE; + PkgInteractive = FALSE; Fake = FALSE; OnVTY = FALSE; DialogActive = FALSE; diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 83972b0cec35..7c271389d0fa 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -565,6 +565,35 @@ nodisks: (void)configLinux(self); #endif + dialog_clear(); + if (USAResident) { + if (!msgYesNo("I see that you are \"USA_RESIDENT\" according to your earlier\n" + "response to the CRYPTO distribution dialog. Do you want to try and\n" + "load the rsaref package from the current media? Some restrictions on\n" + "usage may apply, so be sure to read the package installation output!")) { + PkgInteractive = TRUE; + dialog_clear(); + if (DITEM_STATUS(package_add("rsaref")) != DITEM_SUCCESS) { + msgConfirm("Unable to find an rsaref package on the current intallation media.\n" + "You may wish to switch media types and try again, perhaps\n" + "from an FTP server which carries this package."); + } + PkgInteractive = FALSE; + dialog_clear(); + } + } + else { + if (!msgYesNo("I see that you are not \"USA_RESIDENT\" according to your earlier\n" + "response to the CRYPTO distribution dialog. Do you want to try and\n" + "load the rsaintl package from the current media?")) { + if (DITEM_STATUS(package_add("rsaintl")) != DITEM_SUCCESS) { + msgConfirm("Unable to find an rsaintl package on the current intallation media.\n" + "You may wish to switch media types and try again, perhaps\n" + "from an FTP server which carries this package."); + } + } + } + dialog_clear_norefresh(); if (!msgYesNo("Does this system have a mouse attached to it?")) dmenuOpenSimple(&MenuMouse, FALSE); diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index bce434ebb6f9..460f19404d2a 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -901,8 +901,9 @@ diskLabel(Device *dev) sprintf(osize, "%d", sz); val = msgGetInput(osize, - "Please specify the partition size in blocks or append a trailing M for\n" - "megabytes or C for cylinders. %d blocks (%dMB) are free.", + "Please specify the partition size in blocks or append a trailing G for\n" + "gigabytes, M for megabytes, or C for cylinders.\n" + "%d blocks (%dMB) are free.", sz, sz / ONE_MEG); if (!val || (size = strtol(val, &cp, 0)) <= 0) { clear_wins(); @@ -912,6 +913,8 @@ diskLabel(Device *dev) if (*cp) { if (toupper(*cp) == 'M') size *= ONE_MEG; + else if (toupper(*cp) == 'G') + size *= ONE_GIG; else if (toupper(*cp) == 'C') size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect); } diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index a07d4fef13ca..2d3bf6f05158 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -174,6 +174,7 @@ /* One MB worth of blocks */ #define ONE_MEG 2048 +#define ONE_GIG (ONE_MEG * 1024) /* Which selection attributes to use */ #define ATTR_SELECTED (ColorDisplay ? item_selected_attr : item_attr) @@ -340,7 +341,8 @@ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ -Boolean USAResident; /* Are we cryptographically challenged? */ +Boolean PkgInteractive; /* Is the package going to spew at us? */ +Boolean USAResident; /* Are we cryptographically challenged? */ extern Variable *VarHead; /* The head of the variable chain */ extern Device *mediaDevice; /* Where we're getting our distribution from */ extern unsigned int Dists; /* Which distributions we want */ diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index 2a611b927e89..16be5e2f13f5 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -309,6 +309,8 @@ diskPartition(Device *dev) if (val && (size = strtol(val, &cp, 0)) > 0) { if (*cp && toupper(*cp) == 'M') size *= ONE_MEG; + else if (*cp && toupper(*cp) == 'G') + size *= ONE_GIG; strcpy(tmp, "165"); val = msgGetInput(tmp, "Enter type of partition to create:\n\n" "Pressing Enter will choose the default, a native FreeBSD\n" @@ -733,6 +735,8 @@ diskPartitionNonInteractive(Device *dev) /* Look for sz bytes free */ if (*cp && toupper(*cp) == 'M') sz *= ONE_MEG; + else if (*cp && toupper(*cp) == 'G') + sz *= ONE_GIG; for (i = 0; chunk_info[i]; i++) { /* If a chunk is at least sz MB, use it. */ if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) { diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c index c47c3a048338..9b66fab2180f 100644 --- a/usr.sbin/sysinstall/globals.c +++ b/usr.sbin/sysinstall/globals.c @@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ +Boolean PkgInteractive; /* Is the package going to spew at us? */ Boolean USAResident; /* Are we cryptographically challenged? */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ @@ -63,6 +64,7 @@ globalsInit(void) { DebugFD = -1; ColorDisplay = FALSE; + PkgInteractive = FALSE; Fake = FALSE; OnVTY = FALSE; DialogActive = FALSE; diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 83972b0cec35..7c271389d0fa 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -565,6 +565,35 @@ nodisks: (void)configLinux(self); #endif + dialog_clear(); + if (USAResident) { + if (!msgYesNo("I see that you are \"USA_RESIDENT\" according to your earlier\n" + "response to the CRYPTO distribution dialog. Do you want to try and\n" + "load the rsaref package from the current media? Some restrictions on\n" + "usage may apply, so be sure to read the package installation output!")) { + PkgInteractive = TRUE; + dialog_clear(); + if (DITEM_STATUS(package_add("rsaref")) != DITEM_SUCCESS) { + msgConfirm("Unable to find an rsaref package on the current intallation media.\n" + "You may wish to switch media types and try again, perhaps\n" + "from an FTP server which carries this package."); + } + PkgInteractive = FALSE; + dialog_clear(); + } + } + else { + if (!msgYesNo("I see that you are not \"USA_RESIDENT\" according to your earlier\n" + "response to the CRYPTO distribution dialog. Do you want to try and\n" + "load the rsaintl package from the current media?")) { + if (DITEM_STATUS(package_add("rsaintl")) != DITEM_SUCCESS) { + msgConfirm("Unable to find an rsaintl package on the current intallation media.\n" + "You may wish to switch media types and try again, perhaps\n" + "from an FTP server which carries this package."); + } + } + } + dialog_clear_norefresh(); if (!msgYesNo("Does this system have a mouse attached to it?")) dmenuOpenSimple(&MenuMouse, FALSE); diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index bce434ebb6f9..460f19404d2a 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -901,8 +901,9 @@ diskLabel(Device *dev) sprintf(osize, "%d", sz); val = msgGetInput(osize, - "Please specify the partition size in blocks or append a trailing M for\n" - "megabytes or C for cylinders. %d blocks (%dMB) are free.", + "Please specify the partition size in blocks or append a trailing G for\n" + "gigabytes, M for megabytes, or C for cylinders.\n" + "%d blocks (%dMB) are free.", sz, sz / ONE_MEG); if (!val || (size = strtol(val, &cp, 0)) <= 0) { clear_wins(); @@ -912,6 +913,8 @@ diskLabel(Device *dev) if (*cp) { if (toupper(*cp) == 'M') size *= ONE_MEG; + else if (toupper(*cp) == 'G') + size *= ONE_GIG; else if (toupper(*cp) == 'C') size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect); } diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 8901d08b998a..1959df74a4cf 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -167,7 +167,8 @@ package_extract(Device *dev, char *name, Boolean depended) pid = fork(); if (!pid) { dup2(pfd[0], 0); close(pfd[0]); - dup2(DebugFD, 1); + if (!PkgInteractive) + dup2(DebugFD, 1); close(2); close(pfd[1]); if (isDebug()) diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index a07d4fef13ca..2d3bf6f05158 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -174,6 +174,7 @@ /* One MB worth of blocks */ #define ONE_MEG 2048 +#define ONE_GIG (ONE_MEG * 1024) /* Which selection attributes to use */ #define ATTR_SELECTED (ColorDisplay ? item_selected_attr : item_attr) @@ -340,7 +341,8 @@ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ -Boolean USAResident; /* Are we cryptographically challenged? */ +Boolean PkgInteractive; /* Is the package going to spew at us? */ +Boolean USAResident; /* Are we cryptographically challenged? */ extern Variable *VarHead; /* The head of the variable chain */ extern Device *mediaDevice; /* Where we're getting our distribution from */ extern unsigned int Dists; /* Which distributions we want */