summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-07-09 14:28:22 +0000
committerjkh <jkh@FreeBSD.org>1996-07-09 14:28:22 +0000
commit496e7f4568937e852ced808b4a8cd4446db07162 (patch)
tree5e7e9f24ecabadbd0814225a779cf6e4528beaaf
parenta97e1fa1c1dc7804b2698668fce58aba32b2277b (diff)
downloadFreeBSD-src-496e7f4568937e852ced808b4a8cd4446db07162.zip
FreeBSD-src-496e7f4568937e852ced808b4a8cd4446db07162.tar.gz
A number of improvements in the way statistics are printed, add a "chroot"
option for installing distributions and/or packages to somewhere other than /, say for a case where you're installing to an external disk on some other machine's behalf. More miscellaneous fixes to various problems I stumbled across while adding this stuff.
-rw-r--r--release/sysinstall/dist.c29
-rw-r--r--release/sysinstall/ftp_strat.c8
-rw-r--r--release/sysinstall/install.c18
-rw-r--r--release/sysinstall/misc.c16
-rw-r--r--release/sysinstall/options.c5
-rw-r--r--release/sysinstall/package.c5
-rw-r--r--release/sysinstall/sysinstall.h4
-rw-r--r--usr.sbin/sade/install.c18
-rw-r--r--usr.sbin/sade/misc.c16
-rw-r--r--usr.sbin/sade/sade.h4
-rw-r--r--usr.sbin/sysinstall/dist.c29
-rw-r--r--usr.sbin/sysinstall/install.c18
-rw-r--r--usr.sbin/sysinstall/misc.c16
-rw-r--r--usr.sbin/sysinstall/options.c5
-rw-r--r--usr.sbin/sysinstall/package.c5
-rw-r--r--usr.sbin/sysinstall/sysinstall.h4
16 files changed, 127 insertions, 73 deletions
diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c
index c3d3a52..e5ce07f 100644
--- a/release/sysinstall/dist.c
+++ b/release/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.60 1996/07/02 01:03:37 jkh Exp $
+ * $Id: dist.c,v 1.61 1996/07/08 10:07:57 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -331,7 +331,7 @@ distExtract(char *parent, Distribution *me)
{
int i, status, total;
int cpid, zpid, fd, fd2, chunk, numchunks;
- char *path, *dist, buf[10240];
+ char *path, *dist, buf[BUFSIZ];
const char *tmp;
Attribs *dist_attr;
WINDOW *w = savescr();
@@ -374,8 +374,10 @@ distExtract(char *parent, Distribution *me)
*/
fd = mediaDevice->get(mediaDevice, buf, TRUE);
if (fd >= 0) {
- msgNotify("Extracting %s into %s directory...", me[i].my_name, me[i].my_dir);
- status = mediaExtractDist(me[i].my_dir, fd);
+ char *dir = root_bias(me[i].my_dir);
+
+ msgNotify("Extracting %s into %s directory...", dist, dir);
+ status = mediaExtractDist(dir, fd);
mediaDevice->close(mediaDevice, fd);
goto done;
}
@@ -422,32 +424,33 @@ distExtract(char *parent, Distribution *me)
if (isDebug())
msgDebug("Attempting to extract distribution from %u chunks.\n", numchunks);
- /* We have one or more chunks, go pick them up */
- mediaExtractDistBegin(me[i].my_dir, &fd2, &zpid, &cpid);
total = 0;
- (void)gettimeofday(&start, (struct timezone *)0);
+ /* We have one or more chunks, go pick them up */
+ mediaExtractDistBegin(root_bias(me[i].my_dir), &fd2, &zpid, &cpid);
for (chunk = 0; chunk < numchunks; chunk++) {
- int n, retval;
+ int n, chunktotal, retval;
char prompt[80];
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
+ chunktotal = 0;
+ (void)gettimeofday(&start, (struct timezone *)0);
fd = mediaDevice->get(mediaDevice, buf, FALSE);
if (fd < 0) {
msgConfirm("failed to retreive piece file %s!\n"
"Aborting the transfer", buf);
goto punt;
}
- snprintf(prompt, 80, "Extracting %s into %s directory...", me[i].my_name, me[i].my_dir);
+ snprintf(prompt, 80, "Extracting %s into %s directory...", dist, root_bias(me[i].my_dir));
dialog_gauge("Progress", prompt, 8, 15, 6, 50, (int)((float)(chunk + 1) / numchunks * 100));
while (1) {
int seconds;
- n = read(fd, buf, sizeof buf);
+ n = read(fd, buf, BUFSIZ);
if (n <= 0)
break;
- total += n;
+ total += n, chunktotal += n;
/* Print statistics about how we're doing */
(void) gettimeofday(&stop, (struct timezone *)0);
@@ -458,8 +461,8 @@ distExtract(char *parent, Distribution *me)
seconds = stop.tv_sec + (stop.tv_usec / 1000000.0);
if (!seconds)
seconds = 1;
- msgInfo("%d bytes read from distribution, chunk %d of %d, %d KBytes/second",
- total, chunk + 1, numchunks, (total / seconds) / 1024);
+ msgInfo("%d bytes read from %s distribution, chunk %d of %d @ %.1f KBytes/second",
+ total, dist, chunk + 1, numchunks, (chunktotal / seconds) / 1024.0);
retval = write(fd2, buf, n);
if (retval != n) {
mediaDevice->close(mediaDevice, fd);
diff --git a/release/sysinstall/ftp_strat.c b/release/sysinstall/ftp_strat.c
index 3a6ac0b..689c410 100644
--- a/release/sysinstall/ftp_strat.c
+++ b/release/sysinstall/ftp_strat.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: ftp_strat.c,v 1.20 1996/07/06 02:03:47 jkh Exp $
+ * $Id: ftp_strat.c,v 1.21 1996/07/08 10:08:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -81,16 +81,14 @@ mediaInitFTP(Device *dev)
msgFatal("Missing FTP host or directory specification - something's wrong!");
user = variable_get(VAR_FTP_USER);
- if (!user || !*user) {
- snprintf(password, BUFSIZ, "installer@%s", variable_get(VAR_HOSTNAME));
+ if (!user || !*user)
login_name = "anonymous";
- }
else
login_name = user;
if (variable_get(VAR_FTP_PASS))
strcpy(password, variable_get(VAR_FTP_PASS));
else
- sprintf(password, "%s@%s", login_name, hostname);
+ sprintf(password, "installer@%s", variable_get(VAR_HOSTNAME));
msgNotify("Logging in as %s..", login_name);
if (FtpOpen(ftp, hostname, login_name, password) != 0) {
if (variable_get(VAR_NO_CONFIRM))
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index bc3c7dc..473a861 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.110 1996/07/08 10:08:07 jkh Exp $
+ * $Id: install.c,v 1.111 1996/07/09 07:17:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -802,20 +802,18 @@ installFilesystems(dialogMenuItem *self)
int
installVarDefaults(dialogMenuItem *self)
{
+ char *cp;
+
/* Set default startup options */
variable_set2(VAR_ROUTEDFLAGS, "-q");
variable_set2(VAR_RELNAME, RELEASE_NAME);
variable_set2(VAR_CPIO_VERBOSITY, "high");
variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE);
- if (RunningAsInit)
- variable_set2(VAR_EDITOR, "/usr/bin/ee");
- else {
- char *cp = getenv("EDITOR");
-
- if (!cp)
- cp = "/usr/bin/ee";
- variable_set2(VAR_EDITOR, cp);
- }
+ variable_set2(VAR_INSTALL_ROOT, "/");
+ cp = getenv("EDITOR");
+ if (!cp)
+ cp = "/usr/bin/ee";
+ variable_set2(VAR_EDITOR, cp);
variable_set2(VAR_FTP_USER, "ftp");
variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM");
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c
index e4a1360..1dfc30d 100644
--- a/release/sysinstall/misc.c
+++ b/release/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.20 1996/06/25 18:41:10 jkh Exp $
+ * $Id: misc.c,v 1.21 1996/07/08 08:54:30 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -203,6 +203,20 @@ safe_realloc(void *orig, size_t size)
return ptr;
}
+/* Create a path biased from the VAR_INSTALL_ROOT variable (if not /) */
+char *
+root_bias(char *path)
+{
+ static char tmp[FILENAME_MAX];
+ char *cp = variable_get(VAR_INSTALL_ROOT);
+
+ if (!strcmp(cp, "/"))
+ return path;
+ strcpy(tmp, variable_get(VAR_INSTALL_ROOT));
+ strcat(tmp, path);
+ return tmp;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c
index 94933fe..dd8d879 100644
--- a/release/sysinstall/options.c
+++ b/release/sysinstall/options.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: options.c,v 1.39 1996/06/14 14:33:58 jkh Exp $
+ * $Id: options.c,v 1.40 1996/07/08 10:08:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -99,6 +99,7 @@ mediaCheck(Option opt)
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:"
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
+#define INSTROOT_PROMPT "Please specify a root directory if installing somewhere other than /"
static Option Options[] = {
{ "NFS Secure", "NFS server talks only on a secure port",
@@ -119,6 +120,8 @@ static Option Options[] = {
OPT_IS_FUNC, mediaSetCPIOVerbosity, VAR_CPIO_VERBOSITY, varCheck },
{ "Release Name", "Which release to attempt to load from installation media",
OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck },
+{ "Install Root", "Which directory to unpack distributions or packages relative to",
+ OPT_IS_VAR, INSTROOT_PROMPT, VAR_INSTALL_ROOT, varCheck },
{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs",
OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck },
{ "Browser Exec", "This is the path to the main binary of the browser package",
diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c
index 91a8bd2..881facb 100644
--- a/release/sysinstall/package.c
+++ b/release/sysinstall/package.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: package.c,v 1.40 1996/06/29 02:22:46 jkh Exp $
+ * $Id: package.c,v 1.41 1996/07/08 08:54:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -128,6 +128,7 @@ package_extract(Device *dev, char *name, Boolean depended)
dup2(DebugFD, 1);
close(2);
close(pfd[1]);
+ chroot(variable_get(VAR_INSTALL_ROOT));
i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
msgDebug("pkg_add returns %d status\n", i);
@@ -154,7 +155,7 @@ package_extract(Device *dev, char *name, Boolean depended)
seconds = stop.tv_sec + (stop.tv_usec / 1000000.0);
if (!seconds)
seconds = 1;
- msgInfo("%d bytes read from package %s, %d KBytes/second", tot, name, (tot / seconds) / 1024);
+ msgInfo("%d bytes read from package %s @ %.1f KBytes/second", tot, name, (tot / seconds) / 1024.0);
/* Write it out */
if (write(pfd[1], buf, i) != i) {
msgInfo("Write failure to pkg_add! Package may be corrupt.");
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index c785fc3..5f897fe 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $
+ * $Id: sysinstall.h,v 1.73 1996/07/08 10:08:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -102,6 +102,7 @@
#define VAR_HOSTNAME "hostname"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
+#define VAR_INSTALL_ROOT "installRoot"
#define VAR_IPADDR "ipaddr"
#define VAR_LABEL "label"
#define VAR_LABEL_COUNT "labelCount"
@@ -517,6 +518,7 @@ extern Boolean mediaVerify(void);
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directory_exists(const char *dirname);
+extern char *root_bias(char *path);
extern char *itoa(int value);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index bc3c7dc..473a861 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.110 1996/07/08 10:08:07 jkh Exp $
+ * $Id: install.c,v 1.111 1996/07/09 07:17:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -802,20 +802,18 @@ installFilesystems(dialogMenuItem *self)
int
installVarDefaults(dialogMenuItem *self)
{
+ char *cp;
+
/* Set default startup options */
variable_set2(VAR_ROUTEDFLAGS, "-q");
variable_set2(VAR_RELNAME, RELEASE_NAME);
variable_set2(VAR_CPIO_VERBOSITY, "high");
variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE);
- if (RunningAsInit)
- variable_set2(VAR_EDITOR, "/usr/bin/ee");
- else {
- char *cp = getenv("EDITOR");
-
- if (!cp)
- cp = "/usr/bin/ee";
- variable_set2(VAR_EDITOR, cp);
- }
+ variable_set2(VAR_INSTALL_ROOT, "/");
+ cp = getenv("EDITOR");
+ if (!cp)
+ cp = "/usr/bin/ee";
+ variable_set2(VAR_EDITOR, cp);
variable_set2(VAR_FTP_USER, "ftp");
variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM");
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c
index e4a1360..1dfc30d 100644
--- a/usr.sbin/sade/misc.c
+++ b/usr.sbin/sade/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.20 1996/06/25 18:41:10 jkh Exp $
+ * $Id: misc.c,v 1.21 1996/07/08 08:54:30 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -203,6 +203,20 @@ safe_realloc(void *orig, size_t size)
return ptr;
}
+/* Create a path biased from the VAR_INSTALL_ROOT variable (if not /) */
+char *
+root_bias(char *path)
+{
+ static char tmp[FILENAME_MAX];
+ char *cp = variable_get(VAR_INSTALL_ROOT);
+
+ if (!strcmp(cp, "/"))
+ return path;
+ strcpy(tmp, variable_get(VAR_INSTALL_ROOT));
+ strcat(tmp, path);
+ return tmp;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index c785fc3..5f897fe 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $
+ * $Id: sysinstall.h,v 1.73 1996/07/08 10:08:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -102,6 +102,7 @@
#define VAR_HOSTNAME "hostname"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
+#define VAR_INSTALL_ROOT "installRoot"
#define VAR_IPADDR "ipaddr"
#define VAR_LABEL "label"
#define VAR_LABEL_COUNT "labelCount"
@@ -517,6 +518,7 @@ extern Boolean mediaVerify(void);
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directory_exists(const char *dirname);
+extern char *root_bias(char *path);
extern char *itoa(int value);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index c3d3a52..e5ce07f 100644
--- a/usr.sbin/sysinstall/dist.c
+++ b/usr.sbin/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.60 1996/07/02 01:03:37 jkh Exp $
+ * $Id: dist.c,v 1.61 1996/07/08 10:07:57 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -331,7 +331,7 @@ distExtract(char *parent, Distribution *me)
{
int i, status, total;
int cpid, zpid, fd, fd2, chunk, numchunks;
- char *path, *dist, buf[10240];
+ char *path, *dist, buf[BUFSIZ];
const char *tmp;
Attribs *dist_attr;
WINDOW *w = savescr();
@@ -374,8 +374,10 @@ distExtract(char *parent, Distribution *me)
*/
fd = mediaDevice->get(mediaDevice, buf, TRUE);
if (fd >= 0) {
- msgNotify("Extracting %s into %s directory...", me[i].my_name, me[i].my_dir);
- status = mediaExtractDist(me[i].my_dir, fd);
+ char *dir = root_bias(me[i].my_dir);
+
+ msgNotify("Extracting %s into %s directory...", dist, dir);
+ status = mediaExtractDist(dir, fd);
mediaDevice->close(mediaDevice, fd);
goto done;
}
@@ -422,32 +424,33 @@ distExtract(char *parent, Distribution *me)
if (isDebug())
msgDebug("Attempting to extract distribution from %u chunks.\n", numchunks);
- /* We have one or more chunks, go pick them up */
- mediaExtractDistBegin(me[i].my_dir, &fd2, &zpid, &cpid);
total = 0;
- (void)gettimeofday(&start, (struct timezone *)0);
+ /* We have one or more chunks, go pick them up */
+ mediaExtractDistBegin(root_bias(me[i].my_dir), &fd2, &zpid, &cpid);
for (chunk = 0; chunk < numchunks; chunk++) {
- int n, retval;
+ int n, chunktotal, retval;
char prompt[80];
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
+ chunktotal = 0;
+ (void)gettimeofday(&start, (struct timezone *)0);
fd = mediaDevice->get(mediaDevice, buf, FALSE);
if (fd < 0) {
msgConfirm("failed to retreive piece file %s!\n"
"Aborting the transfer", buf);
goto punt;
}
- snprintf(prompt, 80, "Extracting %s into %s directory...", me[i].my_name, me[i].my_dir);
+ snprintf(prompt, 80, "Extracting %s into %s directory...", dist, root_bias(me[i].my_dir));
dialog_gauge("Progress", prompt, 8, 15, 6, 50, (int)((float)(chunk + 1) / numchunks * 100));
while (1) {
int seconds;
- n = read(fd, buf, sizeof buf);
+ n = read(fd, buf, BUFSIZ);
if (n <= 0)
break;
- total += n;
+ total += n, chunktotal += n;
/* Print statistics about how we're doing */
(void) gettimeofday(&stop, (struct timezone *)0);
@@ -458,8 +461,8 @@ distExtract(char *parent, Distribution *me)
seconds = stop.tv_sec + (stop.tv_usec / 1000000.0);
if (!seconds)
seconds = 1;
- msgInfo("%d bytes read from distribution, chunk %d of %d, %d KBytes/second",
- total, chunk + 1, numchunks, (total / seconds) / 1024);
+ msgInfo("%d bytes read from %s distribution, chunk %d of %d @ %.1f KBytes/second",
+ total, dist, chunk + 1, numchunks, (chunktotal / seconds) / 1024.0);
retval = write(fd2, buf, n);
if (retval != n) {
mediaDevice->close(mediaDevice, fd);
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index bc3c7dc..473a861 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.110 1996/07/08 10:08:07 jkh Exp $
+ * $Id: install.c,v 1.111 1996/07/09 07:17:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -802,20 +802,18 @@ installFilesystems(dialogMenuItem *self)
int
installVarDefaults(dialogMenuItem *self)
{
+ char *cp;
+
/* Set default startup options */
variable_set2(VAR_ROUTEDFLAGS, "-q");
variable_set2(VAR_RELNAME, RELEASE_NAME);
variable_set2(VAR_CPIO_VERBOSITY, "high");
variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE);
- if (RunningAsInit)
- variable_set2(VAR_EDITOR, "/usr/bin/ee");
- else {
- char *cp = getenv("EDITOR");
-
- if (!cp)
- cp = "/usr/bin/ee";
- variable_set2(VAR_EDITOR, cp);
- }
+ variable_set2(VAR_INSTALL_ROOT, "/");
+ cp = getenv("EDITOR");
+ if (!cp)
+ cp = "/usr/bin/ee";
+ variable_set2(VAR_EDITOR, cp);
variable_set2(VAR_FTP_USER, "ftp");
variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM");
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c
index e4a1360..1dfc30d 100644
--- a/usr.sbin/sysinstall/misc.c
+++ b/usr.sbin/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.20 1996/06/25 18:41:10 jkh Exp $
+ * $Id: misc.c,v 1.21 1996/07/08 08:54:30 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -203,6 +203,20 @@ safe_realloc(void *orig, size_t size)
return ptr;
}
+/* Create a path biased from the VAR_INSTALL_ROOT variable (if not /) */
+char *
+root_bias(char *path)
+{
+ static char tmp[FILENAME_MAX];
+ char *cp = variable_get(VAR_INSTALL_ROOT);
+
+ if (!strcmp(cp, "/"))
+ return path;
+ strcpy(tmp, variable_get(VAR_INSTALL_ROOT));
+ strcat(tmp, path);
+ return tmp;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c
index 94933fe..dd8d879 100644
--- a/usr.sbin/sysinstall/options.c
+++ b/usr.sbin/sysinstall/options.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: options.c,v 1.39 1996/06/14 14:33:58 jkh Exp $
+ * $Id: options.c,v 1.40 1996/07/08 10:08:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -99,6 +99,7 @@ mediaCheck(Option opt)
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:"
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
+#define INSTROOT_PROMPT "Please specify a root directory if installing somewhere other than /"
static Option Options[] = {
{ "NFS Secure", "NFS server talks only on a secure port",
@@ -119,6 +120,8 @@ static Option Options[] = {
OPT_IS_FUNC, mediaSetCPIOVerbosity, VAR_CPIO_VERBOSITY, varCheck },
{ "Release Name", "Which release to attempt to load from installation media",
OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck },
+{ "Install Root", "Which directory to unpack distributions or packages relative to",
+ OPT_IS_VAR, INSTROOT_PROMPT, VAR_INSTALL_ROOT, varCheck },
{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs",
OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck },
{ "Browser Exec", "This is the path to the main binary of the browser package",
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c
index 91a8bd2..881facb 100644
--- a/usr.sbin/sysinstall/package.c
+++ b/usr.sbin/sysinstall/package.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: package.c,v 1.40 1996/06/29 02:22:46 jkh Exp $
+ * $Id: package.c,v 1.41 1996/07/08 08:54:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -128,6 +128,7 @@ package_extract(Device *dev, char *name, Boolean depended)
dup2(DebugFD, 1);
close(2);
close(pfd[1]);
+ chroot(variable_get(VAR_INSTALL_ROOT));
i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
msgDebug("pkg_add returns %d status\n", i);
@@ -154,7 +155,7 @@ package_extract(Device *dev, char *name, Boolean depended)
seconds = stop.tv_sec + (stop.tv_usec / 1000000.0);
if (!seconds)
seconds = 1;
- msgInfo("%d bytes read from package %s, %d KBytes/second", tot, name, (tot / seconds) / 1024);
+ msgInfo("%d bytes read from package %s @ %.1f KBytes/second", tot, name, (tot / seconds) / 1024.0);
/* Write it out */
if (write(pfd[1], buf, i) != i) {
msgInfo("Write failure to pkg_add! Package may be corrupt.");
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index c785fc3..5f897fe 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $
+ * $Id: sysinstall.h,v 1.73 1996/07/08 10:08:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -102,6 +102,7 @@
#define VAR_HOSTNAME "hostname"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
+#define VAR_INSTALL_ROOT "installRoot"
#define VAR_IPADDR "ipaddr"
#define VAR_LABEL "label"
#define VAR_LABEL_COUNT "labelCount"
@@ -517,6 +518,7 @@ extern Boolean mediaVerify(void);
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directory_exists(const char *dirname);
+extern char *root_bias(char *path);
extern char *itoa(int value);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
OpenPOWER on IntegriCloud