1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-20 15:43:16 +00:00

Move some of functions around in order to make this stuff easier

to work on.
This commit is contained in:
Jordan K. Hubbard 1996-04-28 01:07:27 +00:00
parent ba67e870cb
commit 3174386dd6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15417
21 changed files with 231 additions and 130 deletions

View File

@ -10,7 +10,8 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c \
ftp_strat.c globals.c index.c install.c installFinal.c \
installUpgrade.c label.c lndir.c main.c makedevs.c media.c \
menus.c misc.c msg.c network.c nfs.c options.c \
package.c system.c tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
package.c samba.c system.c tape.c tcpip.c termcap.c ufs.c \
variable.c wizard.c
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: anonFTP.c,v 1.11 1996/04/13 13:31:19 jkh Exp $
* $Id: anonFTP.c,v 1.12 1996/04/23 01:29:07 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@ -429,9 +429,8 @@ configAnonFTP(dialogMenuItem *self)
/*** If HomeDir does not exist, create it ***/
if (!directory_exists(tconf.homedir)) {
if (!directory_exists(tconf.homedir))
vsystem("mkdir -p %s", tconf.homedir);
}
if (directory_exists(tconf.homedir)) {
msgNotify("Configuring %s for use by anon FTP.", tconf.homedir);
@ -447,7 +446,7 @@ configAnonFTP(dialogMenuItem *self)
if (createFtpUser() == DITEM_SUCCESS) {
msgNotify("Copying password information for anon FTP.");
vsystem("cp /etc/pwd.db %s/etc && chmod 444 %s/etc/pwd.db", tconf.homedir, tconf.homedir);
vsystem("cp /etc/passwd %s/etc && chmod 444 %s/etc/passwd",tconf.homedir, tconf.homedir);
vsystem("cp /etc/passwd %s/etc && chmod 444 %s/etc/passwd", tconf.homedir, tconf.homedir);
vsystem("cp /etc/group %s/etc && chmod 444 %s/etc/group", tconf.homedir, tconf.homedir);
vsystem("chown -R %s.%s %s/pub", FTP_NAME, tconf.group, tconf.homedir);
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: apache.c,v 1.18 1996/04/13 13:31:21 jkh Exp $
* $Id: apache.c,v 1.19 1996/04/23 01:29:08 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@ -499,8 +499,8 @@ configApache(dialogMenuItem *self)
msgNotify("Writing configuration files....");
(void)vsystem("mkdir -p %s/%s", APACHE_BASE,CONFIG_SUBDIR);
sprintf(file, "%s/%s/access.conf", APACHE_BASE,CONFIG_SUBDIR);
(void)vsystem("mkdir -p %s/%s", APACHE_BASE, CONFIG_SUBDIR);
sprintf(file, "%s/%s/access.conf", APACHE_BASE, CONFIG_SUBDIR);
if (file_readable(file))
vsystem("mv -f %s %s.ORIG", file, file);
@ -522,7 +522,7 @@ configApache(dialogMenuItem *self)
i = DITEM_FAILURE;
}
sprintf(file, "%s/%s/httpd.conf", APACHE_BASE,CONFIG_SUBDIR);
sprintf(file, "%s/%s/httpd.conf", APACHE_BASE, CONFIG_SUBDIR);
if (file_readable(file))
vsystem("mv -f %s %s.ORIG", file, file);
@ -558,7 +558,7 @@ configApache(dialogMenuItem *self)
i = DITEM_FAILURE;
}
sprintf(file, "%s/%s/srm.conf", APACHE_BASE,CONFIG_SUBDIR);
sprintf(file, "%s/%s/srm.conf", APACHE_BASE, CONFIG_SUBDIR);
if (file_readable(file))
vsystem("mv -f %s %s.ORIG", file, file);
fptr = fopen(file,"w");

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: config.c,v 1.24 1996/04/13 13:31:25 jkh Exp $
* $Id: config.c,v 1.25 1996/04/23 01:29:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -37,6 +37,13 @@
#include "sysinstall.h"
#include <sys/disklabel.h>
#include <sys/wait.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mount.h>
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
@ -379,7 +386,6 @@ configResolv(void)
if (cp && *cp != '0' && (hp = variable_get(VAR_HOSTNAME))) {
char cp2[255];
(void)vsystem("/bin/hostname %s", hp);
fp = fopen("/etc/hosts", "w");
if (!index(hp, '.'))
cp2[0] = '\0';
@ -537,3 +543,52 @@ configPorts(dialogMenuItem *self)
return DITEM_FAILURE;
return DITEM_SUCCESS;
}
/* Load gated package */
int
configGated(dialogMenuItem *self)
{
if (package_add("gated-3.5a11") == DITEM_SUCCESS)
variable_set2("gated", "YES");
return DITEM_SUCCESS;
}
/* Load pcnfsd package */
int
configPCNFSD(dialogMenuItem *self)
{
if (package_add("pcnfsd-93.02.16") == DITEM_SUCCESS)
variable_set2("pcnfsd", "YES");
return DITEM_SUCCESS;
}
int
configNFSServer(dialogMenuItem *self)
{
char cmd[256];
/* If we're an NFS server, we need an exports file */
if (!file_readable("/etc/exports")) {
WINDOW *w = savescr();
msgConfirm("Operating as an NFS server means that you must first configure\n"
"an /etc/exports file to indicate which hosts are allowed certain\n"
"kinds of access to your local file systems.\n"
"Press [ENTER] now to invoke an editor on /etc/exports\n");
system("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports");
system("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports");
system("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports");
system("echo '#/usr huey louie dewie' >> /etc/exports");
system("echo '#/home -alldirs janice jimmy frank' >> /etc/exports");
system("echo '#/a -maproot=0 bill albert' >> /etc/exports");
system("echo '#' >> /etc/exports");
system("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports");
system("echo >> /etc/exports");
sprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
dialog_clear();
systemExecute(cmd);
restorescr(w);
}
variable_set2("nfs_server", "YES");
return DITEM_SUCCESS;
}

View File

@ -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.86 1996/04/25 18:00:28 jkh Exp $
* $Id: install.c,v 1.87 1996/04/28 00:37:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -518,7 +518,7 @@ installFixup(dialogMenuItem *self)
if (!file_readable("/kernel")) {
if (file_readable("/kernel.GENERIC")) {
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
if (system("cp -p /kernel.GENERIC /kernel")) {
msgConfirm("Unable to link /kernel into place!");
return DITEM_FAILURE;
}
@ -719,7 +719,7 @@ installFilesystems(dialogMenuItem *self)
msgNotify("Copying initial device files..");
/* Copy the boot floppy's dev files */
if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio -pdumv /mnt")) {
if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) {
msgConfirm("Couldn't clone the /dev files!");
return DITEM_FAILURE;
}
@ -759,14 +759,14 @@ copySelf(void)
int i;
msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
i = vsystem("find -x /stand | cpio -pdumv /mnt");
i = vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity());
if (i) {
msgConfirm("Copy returned error status of %d!", i);
return FALSE;
}
/* Copy the /etc files into their rightful place */
if (vsystem("cd /mnt/stand; find etc | cpio -pdumv /mnt")) {
if (vsystem("cd /mnt/stand; find etc | cpio %s -pdum /mnt", cpioVerbosity())) {
msgConfirm("Couldn't copy up the /etc files!");
return TRUE;
}

View File

@ -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: media.c,v 1.35 1996/04/26 18:19:34 jkh Exp $
* $Id: media.c,v 1.36 1996/04/28 00:37:33 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -63,9 +63,11 @@ cdromHook(dialogMenuItem *self)
char *
cpioVerbosity()
{
if (!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high"))
char *cp = variable_get(VAR_CPIO_VERBOSITY);
if (cp && !strcmp(cp, "high"))
return "-v";
else if (!strcmp(variable_get(VAR_CPIO_VERBOSITY), "medium"))
else if (cp && !strcmp(cp, "medium"))
return "-V";
return "";
}
@ -466,7 +468,10 @@ mediaExtractDist(char *dir, int fd)
close(1); open("/dev/null", O_WRONLY);
dup2(1, 2);
}
i = execl("/stand/cpio", "/stand/cpio", "-idum", cpioVerbosity(), "--block-size", mediaTapeBlocksize(), 0);
if (strlen(cpioVerbosity()))
i = execl("/stand/cpio", "/stand/cpio", "-idum", cpioVerbosity(), "--block-size", mediaTapeBlocksize(), 0);
else
i = execl("/stand/cpio", "/stand/cpio", "-idum", "--block-size", mediaTapeBlocksize(), 0);
if (isDebug())
msgDebug("/stand/cpio command returns %d status\n", i);
exit(i);

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: installFinal.c,v 1.27 1996/04/23 01:29:24 jkh Exp $
* $Id: installFinal.c,v 1.28 1996/04/25 17:31:19 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard & Coranth Gryphon. All rights reserved.
@ -35,17 +35,6 @@
*/
#include "sysinstall.h"
#include <sys/disklabel.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mount.h>
/* This file contains all the final configuration thingies */
static DMenu MenuSamba = {
DMENU_CHECKLIST_TYPE,
@ -65,25 +54,6 @@ static DMenu MenuSamba = {
/* These probably shouldn't be hard-coded, but making them options might prove to be even more confusing! */
#define SMB_CONF "./smb.conf"
/* Load gated package */
int
configGated(dialogMenuItem *self)
{
if (package_add("gated-3.5a11") == DITEM_SUCCESS)
variable_set2("gated", "YES");
return DITEM_SUCCESS;
}
/* Load pcnfsd package */
int
configPCNFSD(dialogMenuItem *self)
{
if (package_add("pcnfsd-93.02.16") == DITEM_SUCCESS)
variable_set2("pcnfsd", "YES");
return DITEM_SUCCESS;
}
int
configSamba(dialogMenuItem *self)
{
@ -181,33 +151,3 @@ configSamba(dialogMenuItem *self)
return i | DITEM_RESTORE | DITEM_RECREATE;
}
int
configNFSServer(dialogMenuItem *self)
{
char cmd[256];
/* If we're an NFS server, we need an exports file */
if (!file_readable("/etc/exports")) {
WINDOW *w = savescr();
msgConfirm("Operating as an NFS server means that you must first configure\n"
"an /etc/exports file to indicate which hosts are allowed certain\n"
"kinds of access to your local file systems.\n"
"Press [ENTER] now to invoke an editor on /etc/exports\n");
vsystem("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports");
vsystem("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports");
vsystem("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports");
vsystem("echo '#/usr huey louie dewie' >> /etc/exports");
vsystem("echo '#/home -alldirs janice jimmy frank' >> /etc/exports");
vsystem("echo '#/a -maproot=0 bill albert' >> /etc/exports");
vsystem("echo '#' >> /etc/exports");
vsystem("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports");
vsystem("echo >> /etc/exports");
sprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
dialog_clear();
systemExecute(cmd);
restorescr(w);
}
variable_set2("nfs_server", "YES");
return DITEM_SUCCESS;
}

View File

@ -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.52 1996/04/25 17:31:26 jkh Exp $
* $Id: sysinstall.h,v 1.53 1996/04/28 00:37:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -254,10 +254,6 @@ typedef int (*commandFunc)(char *key, void *data);
#define IPADDR_FIELD_LEN 16
#define EXTRAS_FIELD_LEN 128
/* Verbosity levels for CPIO as expressed by cpio arguments - yuck */
#define CPIO_VERBOSITY (!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "low") ? "" : \
!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "medium") ? "-V" : "-v")
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
char ipaddr[IPADDR_FIELD_LEN];

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: system.c,v 1.52 1996/04/25 17:31:27 jkh Exp $
* $Id: system.c,v 1.53 1996/04/26 18:19:38 jkh Exp $
*
* Jordan Hubbard
*
@ -192,7 +192,7 @@ vsystem(char *fmt, ...)
char *cmd;
int i;
cmd = (char *)malloc(FILENAME_MAX);
cmd = (char *)alloca(FILENAME_MAX);
cmd[0] = '\0';
va_start(args, fmt);
vsnprintf(cmd, FILENAME_MAX, fmt, args);
@ -228,7 +228,6 @@ vsystem(char *fmt, ...)
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
}
return i;
}

View File

@ -10,7 +10,8 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c \
ftp_strat.c globals.c index.c install.c installFinal.c \
installUpgrade.c label.c lndir.c main.c makedevs.c media.c \
menus.c misc.c msg.c network.c nfs.c options.c \
package.c system.c tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
package.c samba.c system.c tape.c tcpip.c termcap.c ufs.c \
variable.c wizard.c
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: config.c,v 1.24 1996/04/13 13:31:25 jkh Exp $
* $Id: config.c,v 1.25 1996/04/23 01:29:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -37,6 +37,13 @@
#include "sysinstall.h"
#include <sys/disklabel.h>
#include <sys/wait.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mount.h>
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
@ -379,7 +386,6 @@ configResolv(void)
if (cp && *cp != '0' && (hp = variable_get(VAR_HOSTNAME))) {
char cp2[255];
(void)vsystem("/bin/hostname %s", hp);
fp = fopen("/etc/hosts", "w");
if (!index(hp, '.'))
cp2[0] = '\0';
@ -537,3 +543,52 @@ configPorts(dialogMenuItem *self)
return DITEM_FAILURE;
return DITEM_SUCCESS;
}
/* Load gated package */
int
configGated(dialogMenuItem *self)
{
if (package_add("gated-3.5a11") == DITEM_SUCCESS)
variable_set2("gated", "YES");
return DITEM_SUCCESS;
}
/* Load pcnfsd package */
int
configPCNFSD(dialogMenuItem *self)
{
if (package_add("pcnfsd-93.02.16") == DITEM_SUCCESS)
variable_set2("pcnfsd", "YES");
return DITEM_SUCCESS;
}
int
configNFSServer(dialogMenuItem *self)
{
char cmd[256];
/* If we're an NFS server, we need an exports file */
if (!file_readable("/etc/exports")) {
WINDOW *w = savescr();
msgConfirm("Operating as an NFS server means that you must first configure\n"
"an /etc/exports file to indicate which hosts are allowed certain\n"
"kinds of access to your local file systems.\n"
"Press [ENTER] now to invoke an editor on /etc/exports\n");
system("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports");
system("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports");
system("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports");
system("echo '#/usr huey louie dewie' >> /etc/exports");
system("echo '#/home -alldirs janice jimmy frank' >> /etc/exports");
system("echo '#/a -maproot=0 bill albert' >> /etc/exports");
system("echo '#' >> /etc/exports");
system("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports");
system("echo >> /etc/exports");
sprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
dialog_clear();
systemExecute(cmd);
restorescr(w);
}
variable_set2("nfs_server", "YES");
return DITEM_SUCCESS;
}

View File

@ -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.86 1996/04/25 18:00:28 jkh Exp $
* $Id: install.c,v 1.87 1996/04/28 00:37:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -518,7 +518,7 @@ installFixup(dialogMenuItem *self)
if (!file_readable("/kernel")) {
if (file_readable("/kernel.GENERIC")) {
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
if (system("cp -p /kernel.GENERIC /kernel")) {
msgConfirm("Unable to link /kernel into place!");
return DITEM_FAILURE;
}
@ -719,7 +719,7 @@ installFilesystems(dialogMenuItem *self)
msgNotify("Copying initial device files..");
/* Copy the boot floppy's dev files */
if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio -pdumv /mnt")) {
if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) {
msgConfirm("Couldn't clone the /dev files!");
return DITEM_FAILURE;
}
@ -759,14 +759,14 @@ copySelf(void)
int i;
msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
i = vsystem("find -x /stand | cpio -pdumv /mnt");
i = vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity());
if (i) {
msgConfirm("Copy returned error status of %d!", i);
return FALSE;
}
/* Copy the /etc files into their rightful place */
if (vsystem("cd /mnt/stand; find etc | cpio -pdumv /mnt")) {
if (vsystem("cd /mnt/stand; find etc | cpio %s -pdum /mnt", cpioVerbosity())) {
msgConfirm("Couldn't copy up the /etc files!");
return TRUE;
}

View File

@ -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.52 1996/04/25 17:31:26 jkh Exp $
* $Id: sysinstall.h,v 1.53 1996/04/28 00:37:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -254,10 +254,6 @@ typedef int (*commandFunc)(char *key, void *data);
#define IPADDR_FIELD_LEN 16
#define EXTRAS_FIELD_LEN 128
/* Verbosity levels for CPIO as expressed by cpio arguments - yuck */
#define CPIO_VERBOSITY (!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "low") ? "" : \
!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "medium") ? "-V" : "-v")
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
char ipaddr[IPADDR_FIELD_LEN];

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: system.c,v 1.52 1996/04/25 17:31:27 jkh Exp $
* $Id: system.c,v 1.53 1996/04/26 18:19:38 jkh Exp $
*
* Jordan Hubbard
*
@ -192,7 +192,7 @@ vsystem(char *fmt, ...)
char *cmd;
int i;
cmd = (char *)malloc(FILENAME_MAX);
cmd = (char *)alloca(FILENAME_MAX);
cmd[0] = '\0';
va_start(args, fmt);
vsnprintf(cmd, FILENAME_MAX, fmt, args);
@ -228,7 +228,6 @@ vsystem(char *fmt, ...)
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
}
return i;
}

View File

@ -10,7 +10,8 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c \
ftp_strat.c globals.c index.c install.c installFinal.c \
installUpgrade.c label.c lndir.c main.c makedevs.c media.c \
menus.c misc.c msg.c network.c nfs.c options.c \
package.c system.c tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
package.c samba.c system.c tape.c tcpip.c termcap.c ufs.c \
variable.c wizard.c
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: anonFTP.c,v 1.11 1996/04/13 13:31:19 jkh Exp $
* $Id: anonFTP.c,v 1.12 1996/04/23 01:29:07 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@ -429,9 +429,8 @@ configAnonFTP(dialogMenuItem *self)
/*** If HomeDir does not exist, create it ***/
if (!directory_exists(tconf.homedir)) {
if (!directory_exists(tconf.homedir))
vsystem("mkdir -p %s", tconf.homedir);
}
if (directory_exists(tconf.homedir)) {
msgNotify("Configuring %s for use by anon FTP.", tconf.homedir);
@ -447,7 +446,7 @@ configAnonFTP(dialogMenuItem *self)
if (createFtpUser() == DITEM_SUCCESS) {
msgNotify("Copying password information for anon FTP.");
vsystem("cp /etc/pwd.db %s/etc && chmod 444 %s/etc/pwd.db", tconf.homedir, tconf.homedir);
vsystem("cp /etc/passwd %s/etc && chmod 444 %s/etc/passwd",tconf.homedir, tconf.homedir);
vsystem("cp /etc/passwd %s/etc && chmod 444 %s/etc/passwd", tconf.homedir, tconf.homedir);
vsystem("cp /etc/group %s/etc && chmod 444 %s/etc/group", tconf.homedir, tconf.homedir);
vsystem("chown -R %s.%s %s/pub", FTP_NAME, tconf.group, tconf.homedir);
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: config.c,v 1.24 1996/04/13 13:31:25 jkh Exp $
* $Id: config.c,v 1.25 1996/04/23 01:29:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -37,6 +37,13 @@
#include "sysinstall.h"
#include <sys/disklabel.h>
#include <sys/wait.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mount.h>
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
@ -379,7 +386,6 @@ configResolv(void)
if (cp && *cp != '0' && (hp = variable_get(VAR_HOSTNAME))) {
char cp2[255];
(void)vsystem("/bin/hostname %s", hp);
fp = fopen("/etc/hosts", "w");
if (!index(hp, '.'))
cp2[0] = '\0';
@ -537,3 +543,52 @@ configPorts(dialogMenuItem *self)
return DITEM_FAILURE;
return DITEM_SUCCESS;
}
/* Load gated package */
int
configGated(dialogMenuItem *self)
{
if (package_add("gated-3.5a11") == DITEM_SUCCESS)
variable_set2("gated", "YES");
return DITEM_SUCCESS;
}
/* Load pcnfsd package */
int
configPCNFSD(dialogMenuItem *self)
{
if (package_add("pcnfsd-93.02.16") == DITEM_SUCCESS)
variable_set2("pcnfsd", "YES");
return DITEM_SUCCESS;
}
int
configNFSServer(dialogMenuItem *self)
{
char cmd[256];
/* If we're an NFS server, we need an exports file */
if (!file_readable("/etc/exports")) {
WINDOW *w = savescr();
msgConfirm("Operating as an NFS server means that you must first configure\n"
"an /etc/exports file to indicate which hosts are allowed certain\n"
"kinds of access to your local file systems.\n"
"Press [ENTER] now to invoke an editor on /etc/exports\n");
system("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports");
system("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports");
system("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports");
system("echo '#/usr huey louie dewie' >> /etc/exports");
system("echo '#/home -alldirs janice jimmy frank' >> /etc/exports");
system("echo '#/a -maproot=0 bill albert' >> /etc/exports");
system("echo '#' >> /etc/exports");
system("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports");
system("echo >> /etc/exports");
sprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
dialog_clear();
systemExecute(cmd);
restorescr(w);
}
variable_set2("nfs_server", "YES");
return DITEM_SUCCESS;
}

View File

@ -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.86 1996/04/25 18:00:28 jkh Exp $
* $Id: install.c,v 1.87 1996/04/28 00:37:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -518,7 +518,7 @@ installFixup(dialogMenuItem *self)
if (!file_readable("/kernel")) {
if (file_readable("/kernel.GENERIC")) {
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
if (system("cp -p /kernel.GENERIC /kernel")) {
msgConfirm("Unable to link /kernel into place!");
return DITEM_FAILURE;
}
@ -719,7 +719,7 @@ installFilesystems(dialogMenuItem *self)
msgNotify("Copying initial device files..");
/* Copy the boot floppy's dev files */
if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio -pdumv /mnt")) {
if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio %s -pdum /mnt", cpioVerbosity())) {
msgConfirm("Couldn't clone the /dev files!");
return DITEM_FAILURE;
}
@ -759,14 +759,14 @@ copySelf(void)
int i;
msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
i = vsystem("find -x /stand | cpio -pdumv /mnt");
i = vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity());
if (i) {
msgConfirm("Copy returned error status of %d!", i);
return FALSE;
}
/* Copy the /etc files into their rightful place */
if (vsystem("cd /mnt/stand; find etc | cpio -pdumv /mnt")) {
if (vsystem("cd /mnt/stand; find etc | cpio %s -pdum /mnt", cpioVerbosity())) {
msgConfirm("Couldn't copy up the /etc files!");
return TRUE;
}

View File

@ -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: media.c,v 1.35 1996/04/26 18:19:34 jkh Exp $
* $Id: media.c,v 1.36 1996/04/28 00:37:33 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -63,9 +63,11 @@ cdromHook(dialogMenuItem *self)
char *
cpioVerbosity()
{
if (!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high"))
char *cp = variable_get(VAR_CPIO_VERBOSITY);
if (cp && !strcmp(cp, "high"))
return "-v";
else if (!strcmp(variable_get(VAR_CPIO_VERBOSITY), "medium"))
else if (cp && !strcmp(cp, "medium"))
return "-V";
return "";
}
@ -466,7 +468,10 @@ mediaExtractDist(char *dir, int fd)
close(1); open("/dev/null", O_WRONLY);
dup2(1, 2);
}
i = execl("/stand/cpio", "/stand/cpio", "-idum", cpioVerbosity(), "--block-size", mediaTapeBlocksize(), 0);
if (strlen(cpioVerbosity()))
i = execl("/stand/cpio", "/stand/cpio", "-idum", cpioVerbosity(), "--block-size", mediaTapeBlocksize(), 0);
else
i = execl("/stand/cpio", "/stand/cpio", "-idum", "--block-size", mediaTapeBlocksize(), 0);
if (isDebug())
msgDebug("/stand/cpio command returns %d status\n", i);
exit(i);

View File

@ -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.52 1996/04/25 17:31:26 jkh Exp $
* $Id: sysinstall.h,v 1.53 1996/04/28 00:37:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -254,10 +254,6 @@ typedef int (*commandFunc)(char *key, void *data);
#define IPADDR_FIELD_LEN 16
#define EXTRAS_FIELD_LEN 128
/* Verbosity levels for CPIO as expressed by cpio arguments - yuck */
#define CPIO_VERBOSITY (!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "low") ? "" : \
!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "medium") ? "-V" : "-v")
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
char ipaddr[IPADDR_FIELD_LEN];

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: system.c,v 1.52 1996/04/25 17:31:27 jkh Exp $
* $Id: system.c,v 1.53 1996/04/26 18:19:38 jkh Exp $
*
* Jordan Hubbard
*
@ -192,7 +192,7 @@ vsystem(char *fmt, ...)
char *cmd;
int i;
cmd = (char *)malloc(FILENAME_MAX);
cmd = (char *)alloca(FILENAME_MAX);
cmd[0] = '\0';
va_start(args, fmt);
vsnprintf(cmd, FILENAME_MAX, fmt, args);
@ -228,7 +228,6 @@ vsystem(char *fmt, ...)
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
}
return i;
}