mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Add a new -fake argument to make sysinstall not actually change things while
I'm testing it.
This commit is contained in:
parent
9591b63489
commit
c97113d14f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15439
@ -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.26 1996/04/28 01:07:21 jkh Exp $
|
||||
* $Id: config.c,v 1.27 1996/04/28 03:26:46 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -581,16 +581,16 @@ configNFSServer(dialogMenuItem *self)
|
||||
"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));
|
||||
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");
|
||||
vsprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
|
||||
dialog_clear();
|
||||
systemExecute(cmd);
|
||||
restorescr(w);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: disks.c,v 1.43 1996/04/28 00:37:28 jkh Exp $
|
||||
* $Id: disks.c,v 1.44 1996/04/28 03:26:49 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -502,7 +502,7 @@ diskPartitionWrite(dialogMenuItem *self)
|
||||
|
||||
Set_Boot_Blocks(d, boot1, boot2);
|
||||
msgNotify("Writing partition information to drive %s", d->name);
|
||||
if (Write_Disk(d)) {
|
||||
if (!Fake && Write_Disk(d)) {
|
||||
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: ftp.c,v 1.14.2.1 1995/10/21 14:06:35 jkh Exp $
|
||||
* $Id: ftp.c,v 1.15 1995/12/07 10:33:47 peter Exp $
|
||||
*
|
||||
* Return values have been sanitized:
|
||||
* -1 error, but you (still) have a session.
|
||||
@ -49,9 +49,9 @@ debug(FTP_t ftp, const char *fmt, ...)
|
||||
va_start(ap, fmt);
|
||||
#ifdef STANDALONE_FTP
|
||||
strcpy(p,"LIBFTP: ");
|
||||
(void) vsnprintf(p+strlen(p), sizeof p - strlen(p), fmt, ap);
|
||||
(void) vsnprintf(p + strlen(p), sizeof p - strlen(p), fmt, ap);
|
||||
va_end(ap);
|
||||
write(ftp->fd_debug,p,strlen(p));
|
||||
write(ftp->fd_debug, p, strlen(p));
|
||||
#else
|
||||
if (isDebug()) {
|
||||
(void) vsnprintf(p, sizeof p - strlen(p), fmt, ap);
|
||||
@ -64,7 +64,7 @@ static int
|
||||
writes(int fd, char *s)
|
||||
{
|
||||
int i = strlen(s);
|
||||
if (i != write(fd,s,i))
|
||||
if (i != write(fd, s, i))
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
@ -76,14 +76,14 @@ get_a_line(FTP_t ftp)
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<BUFSIZ;) {
|
||||
j = read(ftp->fd_ctrl,buf+i,1);
|
||||
j = read(ftp->fd_ctrl, buf+i, 1);
|
||||
if (j != 1)
|
||||
return 0;
|
||||
if (buf[i] == '\r' || buf[i] == '\n') {
|
||||
if (!i)
|
||||
continue;
|
||||
buf[i] = '\0';
|
||||
debug(ftp, "received <%s>\n",buf);
|
||||
debug(ftp, "received <%s>\n", buf);
|
||||
return buf;
|
||||
}
|
||||
i++;
|
||||
@ -152,11 +152,11 @@ cmd(FTP_t ftp, const char *fmt, ...)
|
||||
(void) vsnprintf(p, sizeof p, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
debug(ftp, "send <%s>\n",p);
|
||||
debug(ftp, "send <%s>\n", p);
|
||||
strcat(p,"\r\n");
|
||||
if (writes(ftp->fd_ctrl,p))
|
||||
if (writes(ftp->fd_ctrl, p))
|
||||
return -2;
|
||||
i = get_a_number(ftp,0);
|
||||
i = get_a_number(ftp, 0);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -239,11 +239,12 @@ FtpOpen(FTP_t ftp, char *host, char *user, char *passwd)
|
||||
|
||||
debug(ftp, "open (%d)\n",get_a_number(ftp,0));
|
||||
|
||||
i = cmd(ftp,"USER %s",user);
|
||||
i = cmd(ftp, "USER %s", user);
|
||||
if (i >= 300 && i < 400)
|
||||
i = cmd(ftp,"PASS %s",passwd);
|
||||
if (i >= 299 || i < 0) {
|
||||
close(ftp->fd_ctrl); ftp->fd_ctrl = -1;
|
||||
close(ftp->fd_ctrl);
|
||||
ftp->fd_ctrl = -1;
|
||||
return zap(ftp);
|
||||
}
|
||||
ftp->state = isopen;
|
||||
@ -267,9 +268,10 @@ int
|
||||
FtpChdir(FTP_t ftp, char *dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ftp->state != isopen)
|
||||
return botch(ftp,"FtpChdir","open");
|
||||
i = cmd(ftp,"CWD %s",dir);
|
||||
i = cmd(ftp, "CWD %s", dir);
|
||||
if (i < 0)
|
||||
return i;
|
||||
else if (i != 250)
|
||||
@ -286,27 +288,27 @@ FtpGet(FTP_t ftp, char *file)
|
||||
struct sockaddr_in sin;
|
||||
u_long a;
|
||||
|
||||
debug(ftp, "FtpGet(ftp,%s)\n",file);
|
||||
debug(ftp, "FtpGet(ftp,%s)\n", file);
|
||||
if (ftp->state != isopen)
|
||||
return botch(ftp,"FtpGet","open");
|
||||
if(ftp->binary) {
|
||||
i = cmd(ftp,"TYPE I");
|
||||
return botch(ftp, "FtpGet", "open");
|
||||
if (ftp->binary) {
|
||||
i = cmd(ftp, "TYPE I");
|
||||
if (i < 0 || FTP_TIMEOUT(i))
|
||||
return zap(ftp);
|
||||
if (i > 299)
|
||||
return -1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
||||
if ((s = socket(ftp->addrtype, SOCK_STREAM, 0)) < 0)
|
||||
return zap(ftp);
|
||||
|
||||
if (ftp->passive) {
|
||||
debug(ftp, "send <%s>\n","PASV");
|
||||
if (writes(ftp->fd_ctrl,"PASV\r\n"))
|
||||
debug(ftp, "send <%s>\n", "PASV");
|
||||
if (writes(ftp->fd_ctrl, "PASV\r\n"))
|
||||
return zap(ftp);
|
||||
i = get_a_number(ftp,&q);
|
||||
i = get_a_number(ftp, &q);
|
||||
if (i < 0)
|
||||
return zap(ftp);
|
||||
if (i != 227)
|
||||
@ -316,14 +318,14 @@ FtpGet(FTP_t ftp, char *file)
|
||||
if (!*q)
|
||||
return zap(ftp);
|
||||
q--;
|
||||
for(i=0;i<6;i++) {
|
||||
for(i = 0; i < 6; i++) {
|
||||
q++;
|
||||
addr[i] = strtol(q,&q,10);
|
||||
addr[i] = strtol(q, &q, 10);
|
||||
}
|
||||
|
||||
sin.sin_family = ftp->addrtype;
|
||||
bcopy(addr, (char *)&sin.sin_addr, 4);
|
||||
bcopy(addr+4, (char *)&sin.sin_port, 2);
|
||||
bcopy(addr + 4, (char *)&sin.sin_port, 2);
|
||||
debug(ftp, "Opening active socket to %s : %u\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
|
||||
|
||||
debug(ftp, "Connecting to %s:%u\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
|
||||
@ -333,7 +335,7 @@ FtpGet(FTP_t ftp, char *file)
|
||||
return -1;
|
||||
}
|
||||
ftp->fd_xfer = s;
|
||||
i = cmd(ftp,"RETR %s",file);
|
||||
i = cmd(ftp,"RETR %s", file);
|
||||
if (i < 0 || FTP_TIMEOUT(i)) {
|
||||
close(s);
|
||||
return zap(ftp);
|
||||
@ -348,31 +350,31 @@ FtpGet(FTP_t ftp, char *file)
|
||||
return s;
|
||||
} else {
|
||||
i = sizeof sin;
|
||||
getsockname(ftp->fd_ctrl,(struct sockaddr *)&sin,&i);
|
||||
getsockname(ftp->fd_ctrl, (struct sockaddr *)&sin, &i);
|
||||
sin.sin_port = 0;
|
||||
i = sizeof sin;
|
||||
if (bind(s,(struct sockaddr *)&sin, i) < 0) {
|
||||
close (s);
|
||||
debug(ftp,"bind failed %d\n",errno);
|
||||
return zap(ftp);
|
||||
close (s);
|
||||
debug(ftp, "bind failed %d\n", errno);
|
||||
return zap(ftp);
|
||||
}
|
||||
getsockname(s,(struct sockaddr *)&sin,&i);
|
||||
if (listen(s,1) < 0) {
|
||||
close (s);
|
||||
debug(ftp,"listen failed %d\n",errno);
|
||||
return zap(ftp);
|
||||
getsockname(s, (struct sockaddr *)&sin, &i);
|
||||
if (listen(s, 1) < 0) {
|
||||
close (s);
|
||||
debug(ftp, "listen failed %d\n", errno);
|
||||
return zap(ftp);
|
||||
}
|
||||
a = ntohl(sin.sin_addr.s_addr);
|
||||
i = cmd(ftp,"PORT %d,%d,%d,%d,%d,%d",
|
||||
i = cmd(ftp, "PORT %d,%d,%d,%d,%d,%d",
|
||||
(a >> 24) & 0xff,
|
||||
(a >> 16) & 0xff,
|
||||
(a >> 8) & 0xff,
|
||||
a & 0xff,
|
||||
a & 0xff,
|
||||
(ntohs(sin.sin_port) >> 8) & 0xff,
|
||||
ntohs(sin.sin_port) & 0xff);
|
||||
ntohs(sin.sin_port) & 0xff);
|
||||
if (i != 200)
|
||||
return -1;
|
||||
i = cmd(ftp,"RETR %s",file);
|
||||
i = cmd(ftp,"RETR %s", file);
|
||||
if (i < 0) {
|
||||
close(s);
|
||||
return zap(ftp);
|
||||
@ -403,9 +405,10 @@ FtpEOF(FTP_t ftp)
|
||||
int i;
|
||||
|
||||
if (ftp->state != xfer)
|
||||
return botch(ftp,"FtpEOF","xfer");
|
||||
return botch(ftp, "FtpEOF", "xfer");
|
||||
debug(ftp, "FtpEOF(ftp)\n");
|
||||
close(ftp->fd_xfer); ftp->fd_xfer = -1;
|
||||
close(ftp->fd_xfer);
|
||||
ftp->fd_xfer = -1;
|
||||
ftp->state = isopen;
|
||||
i = get_a_number(ftp,0);
|
||||
if (i < 0)
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: globals.c,v 1.11 1995/12/07 10:33:50 peter Exp $
|
||||
* $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -41,14 +41,15 @@
|
||||
* whatever values we feel are appropriate.
|
||||
*/
|
||||
|
||||
int DebugFD; /* Where diagnostic output goes */
|
||||
int DebugFD; /* Where diagnostic output goes */
|
||||
Boolean Fake; /* Only pretend to be useful */
|
||||
Boolean RunningAsInit; /* Are we running as init? */
|
||||
Boolean DialogActive;
|
||||
Boolean ColorDisplay;
|
||||
Boolean OnVTY;
|
||||
Variable *VarHead; /* The head of the variable chain */
|
||||
Boolean DialogActive; /* Is libdialog initialized? */
|
||||
Boolean ColorDisplay; /* Are we on a color display? */
|
||||
Boolean OnVTY; /* Are we on a VTY? */
|
||||
Variable *VarHead; /* The head of the variable chain */
|
||||
Device *mediaDevice; /* Where we're installing from */
|
||||
int BootMgr;
|
||||
int BootMgr; /* Which boot manager we're using */
|
||||
|
||||
/*
|
||||
* Yes, I know some of these are already automatically initialized as
|
||||
@ -59,6 +60,7 @@ globalsInit(void)
|
||||
{
|
||||
DebugFD = -1;
|
||||
ColorDisplay = FALSE;
|
||||
Fake = FALSE;
|
||||
OnVTY = FALSE;
|
||||
DialogActive = FALSE;
|
||||
VarHead = NULL;
|
||||
|
@ -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.88 1996/04/28 01:07:22 jkh Exp $
|
||||
* $Id: install.c,v 1.89 1996/04/28 03:27:02 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -159,7 +159,8 @@ installInitial(void)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
if (!variable_get(DISK_LABELLED)) {
|
||||
msgConfirm("You need to assign disk labels before you can proceed with\nthe installation.");
|
||||
msgConfirm("You need to assign disk labels before you can proceed with\n"
|
||||
"the installation.");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
/* If it's labelled, assume it's also partitioned */
|
||||
@ -518,7 +519,7 @@ installFixup(dialogMenuItem *self)
|
||||
|
||||
if (!file_readable("/kernel")) {
|
||||
if (file_readable("/kernel.GENERIC")) {
|
||||
if (system("cp -p /kernel.GENERIC /kernel")) {
|
||||
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
|
||||
msgConfirm("Unable to link /kernel into place!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
@ -567,8 +568,8 @@ installFixup(dialogMenuItem *self)
|
||||
msgNotify("Fixing permissions..");
|
||||
/* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */
|
||||
if (directory_exists("/usr/X11R6")) {
|
||||
system("chmod -R a+r /usr/X11R6");
|
||||
system("find /usr/X11R6 -type d | xargs chmod a+x");
|
||||
vsystem("chmod -R a+r /usr/X11R6");
|
||||
vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
|
||||
}
|
||||
/* BOGON #2: We leave /etc in a bad state */
|
||||
chmod("/etc", 0755);
|
||||
@ -729,6 +730,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Initialize various user-settable values to their defaults */
|
||||
int
|
||||
installVarDefaults(dialogMenuItem *self)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: installUpgrade.c,v 1.22 1996/04/25 17:31:20 jkh Exp $
|
||||
* $Id: installUpgrade.c,v 1.23 1996/04/28 03:27:05 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -264,7 +264,10 @@ installUpgrade(dialogMenuItem *self)
|
||||
if (!rootExtract()) {
|
||||
msgConfirm("Failed to load the ROOT distribution. Please correct\n"
|
||||
"this problem and try again (the system will now reboot).");
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (extractingBin) {
|
||||
@ -284,13 +287,16 @@ installUpgrade(dialogMenuItem *self)
|
||||
(void)vsystem("cp -pr /etc/* %s", saved_etc);
|
||||
}
|
||||
if (file_readable("/kernel")) {
|
||||
msgNotify("Moving old kernel to /kernel.205");
|
||||
if (system("chflags noschg /kernel && mv /kernel /kernel.205")) {
|
||||
msgNotify("Moving old kernel to /kernel.prev");
|
||||
if (system("chflags noschg /kernel && mv /kernel /kernel.prev")) {
|
||||
if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n"
|
||||
"treat this as a big problem and abort the upgrade? Due to the\n"
|
||||
"way that this upgrade process works, you will have to reboot\n"
|
||||
"and start over from the beginning. Select Yes to reboot now")) {
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +309,10 @@ installUpgrade(dialogMenuItem *self)
|
||||
"should be considered a failure and started from the beginning, sorry!\n"
|
||||
"The system will reboot now.");
|
||||
dialog_clear();
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
msgConfirm("The extraction process seems to have had some problems, but we got most\n"
|
||||
"of the essentials. We'll treat this as a warning since it may have been\n"
|
||||
@ -359,9 +368,13 @@ installUpgrade(dialogMenuItem *self)
|
||||
msgDebug("Unable to get the terminal attributes!\n");
|
||||
printf("Well, good luck! When you're done, please type \"reboot\" or exit\n"
|
||||
"the shell to reboot the new system.\n");
|
||||
execlp("sh", "-sh", 0);
|
||||
if (!Fake)
|
||||
execlp("sh", "-sh", 0);
|
||||
else
|
||||
exit(0);
|
||||
msgDebug("Was unable to execute sh for post-upgrade shell!\n");
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
@ -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: main.c,v 1.16 1996/04/07 03:52:31 jkh Exp $
|
||||
* $Id: main.c,v 1.17 1996/04/13 13:31:51 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -65,6 +65,15 @@ main(int argc, char **argv)
|
||||
/* Set up whatever things need setting up */
|
||||
systemInitialize(argc, argv);
|
||||
|
||||
/* Set default flag and variable values */
|
||||
installVarDefaults(NULL);
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-fake")) {
|
||||
variable_set2(VAR_DEBUG, "YES");
|
||||
Fake = TRUE;
|
||||
msgConfirm("I'll be just faking it from here on out, OK?");
|
||||
}
|
||||
|
||||
/* Try to preserve our scroll-back buffer */
|
||||
if (OnVTY)
|
||||
for (curr = 0; curr < 25; curr++)
|
||||
@ -73,9 +82,6 @@ main(int argc, char **argv)
|
||||
/* Probe for all relevant devices on the system */
|
||||
deviceGetAll();
|
||||
|
||||
/* Set default flag and variable values */
|
||||
installVarDefaults(NULL);
|
||||
|
||||
/* Begin user dialog at outer menu */
|
||||
while (1) {
|
||||
choice = scroll = curr = max = 0;
|
||||
|
@ -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: network.c,v 1.10 1996/04/13 13:32:03 jkh Exp $
|
||||
* $Id: network.c,v 1.11 1996/04/23 01:29:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -177,7 +177,7 @@ startPPP(Device *devp)
|
||||
int fd2;
|
||||
FILE *fp;
|
||||
char *val;
|
||||
pid_t pid;
|
||||
pid_t pid = 0;
|
||||
char myaddr[16], provider[16], speed[16];
|
||||
|
||||
/* These are needed to make ppp work */
|
||||
@ -233,7 +233,8 @@ startPPP(Device *devp)
|
||||
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
|
||||
return 0;
|
||||
}
|
||||
if (!(pid = fork())) {
|
||||
|
||||
if (!Fake && !(pid = fork())) {
|
||||
int i, fd;
|
||||
struct termios foo;
|
||||
extern int login_tty(int);
|
||||
|
@ -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.53 1996/04/28 00:37:36 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.54 1996/04/28 01:07:26 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -264,6 +264,7 @@ typedef struct _devPriv {
|
||||
|
||||
/*** Externs ***/
|
||||
extern int DebugFD; /* Where diagnostic output goes */
|
||||
extern Boolean Fake; /* Don't actually modify anything - testing */
|
||||
extern Boolean SystemWasInstalled; /* Did we install it? */
|
||||
extern Boolean RunningAsInit; /* Are we running stand-alone? */
|
||||
extern Boolean DialogActive; /* Is the dialog() stuff up? */
|
||||
|
@ -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.54 1996/04/28 01:07:27 jkh Exp $
|
||||
* $Id: system.c,v 1.55 1996/04/28 03:27:26 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -109,7 +109,12 @@ systemExecute(char *command)
|
||||
foo.c_cc[VERASE] = '\010';
|
||||
tcsetattr(0, TCSANOW, &foo);
|
||||
}
|
||||
status = system(command);
|
||||
if (!Fake)
|
||||
status = system(command);
|
||||
else {
|
||||
status = 0;
|
||||
msgDebug("systemExecute: Faked execution of `%s'\n", command);
|
||||
}
|
||||
DialogActive = TRUE;
|
||||
return status;
|
||||
}
|
||||
@ -199,6 +204,10 @@ vsystem(char *fmt, ...)
|
||||
va_end(args);
|
||||
|
||||
omask = sigblock(sigmask(SIGCHLD));
|
||||
if (Fake) {
|
||||
msgDebug("vsystem: Faked execution of `%s'\n", cmd);
|
||||
return 0;
|
||||
}
|
||||
if (isDebug())
|
||||
msgDebug("Executing command `%s'\n", cmd);
|
||||
pid = fork();
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: wizard.c,v 1.6.2.1 1995/09/20 10:43:13 jkh Exp $
|
||||
* $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -208,7 +208,7 @@ slice_wizard(Disk *d)
|
||||
}
|
||||
if (!strcasecmp(*cmds,"write")) {
|
||||
printf("Write=%d\n",
|
||||
Write_Disk(d));
|
||||
Fake ? 0 : Write_Disk(d));
|
||||
Free_Disk(d);
|
||||
d = Open_Disk(d->name);
|
||||
continue;
|
||||
|
@ -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.26 1996/04/28 01:07:21 jkh Exp $
|
||||
* $Id: config.c,v 1.27 1996/04/28 03:26:46 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -581,16 +581,16 @@ configNFSServer(dialogMenuItem *self)
|
||||
"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));
|
||||
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");
|
||||
vsprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
|
||||
dialog_clear();
|
||||
systemExecute(cmd);
|
||||
restorescr(w);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: disks.c,v 1.43 1996/04/28 00:37:28 jkh Exp $
|
||||
* $Id: disks.c,v 1.44 1996/04/28 03:26:49 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -502,7 +502,7 @@ diskPartitionWrite(dialogMenuItem *self)
|
||||
|
||||
Set_Boot_Blocks(d, boot1, boot2);
|
||||
msgNotify("Writing partition information to drive %s", d->name);
|
||||
if (Write_Disk(d)) {
|
||||
if (!Fake && Write_Disk(d)) {
|
||||
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: globals.c,v 1.11 1995/12/07 10:33:50 peter Exp $
|
||||
* $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -41,14 +41,15 @@
|
||||
* whatever values we feel are appropriate.
|
||||
*/
|
||||
|
||||
int DebugFD; /* Where diagnostic output goes */
|
||||
int DebugFD; /* Where diagnostic output goes */
|
||||
Boolean Fake; /* Only pretend to be useful */
|
||||
Boolean RunningAsInit; /* Are we running as init? */
|
||||
Boolean DialogActive;
|
||||
Boolean ColorDisplay;
|
||||
Boolean OnVTY;
|
||||
Variable *VarHead; /* The head of the variable chain */
|
||||
Boolean DialogActive; /* Is libdialog initialized? */
|
||||
Boolean ColorDisplay; /* Are we on a color display? */
|
||||
Boolean OnVTY; /* Are we on a VTY? */
|
||||
Variable *VarHead; /* The head of the variable chain */
|
||||
Device *mediaDevice; /* Where we're installing from */
|
||||
int BootMgr;
|
||||
int BootMgr; /* Which boot manager we're using */
|
||||
|
||||
/*
|
||||
* Yes, I know some of these are already automatically initialized as
|
||||
@ -59,6 +60,7 @@ globalsInit(void)
|
||||
{
|
||||
DebugFD = -1;
|
||||
ColorDisplay = FALSE;
|
||||
Fake = FALSE;
|
||||
OnVTY = FALSE;
|
||||
DialogActive = FALSE;
|
||||
VarHead = NULL;
|
||||
|
@ -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.88 1996/04/28 01:07:22 jkh Exp $
|
||||
* $Id: install.c,v 1.89 1996/04/28 03:27:02 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -159,7 +159,8 @@ installInitial(void)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
if (!variable_get(DISK_LABELLED)) {
|
||||
msgConfirm("You need to assign disk labels before you can proceed with\nthe installation.");
|
||||
msgConfirm("You need to assign disk labels before you can proceed with\n"
|
||||
"the installation.");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
/* If it's labelled, assume it's also partitioned */
|
||||
@ -518,7 +519,7 @@ installFixup(dialogMenuItem *self)
|
||||
|
||||
if (!file_readable("/kernel")) {
|
||||
if (file_readable("/kernel.GENERIC")) {
|
||||
if (system("cp -p /kernel.GENERIC /kernel")) {
|
||||
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
|
||||
msgConfirm("Unable to link /kernel into place!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
@ -567,8 +568,8 @@ installFixup(dialogMenuItem *self)
|
||||
msgNotify("Fixing permissions..");
|
||||
/* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */
|
||||
if (directory_exists("/usr/X11R6")) {
|
||||
system("chmod -R a+r /usr/X11R6");
|
||||
system("find /usr/X11R6 -type d | xargs chmod a+x");
|
||||
vsystem("chmod -R a+r /usr/X11R6");
|
||||
vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
|
||||
}
|
||||
/* BOGON #2: We leave /etc in a bad state */
|
||||
chmod("/etc", 0755);
|
||||
@ -729,6 +730,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Initialize various user-settable values to their defaults */
|
||||
int
|
||||
installVarDefaults(dialogMenuItem *self)
|
||||
{
|
||||
|
@ -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: main.c,v 1.16 1996/04/07 03:52:31 jkh Exp $
|
||||
* $Id: main.c,v 1.17 1996/04/13 13:31:51 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -65,6 +65,15 @@ main(int argc, char **argv)
|
||||
/* Set up whatever things need setting up */
|
||||
systemInitialize(argc, argv);
|
||||
|
||||
/* Set default flag and variable values */
|
||||
installVarDefaults(NULL);
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-fake")) {
|
||||
variable_set2(VAR_DEBUG, "YES");
|
||||
Fake = TRUE;
|
||||
msgConfirm("I'll be just faking it from here on out, OK?");
|
||||
}
|
||||
|
||||
/* Try to preserve our scroll-back buffer */
|
||||
if (OnVTY)
|
||||
for (curr = 0; curr < 25; curr++)
|
||||
@ -73,9 +82,6 @@ main(int argc, char **argv)
|
||||
/* Probe for all relevant devices on the system */
|
||||
deviceGetAll();
|
||||
|
||||
/* Set default flag and variable values */
|
||||
installVarDefaults(NULL);
|
||||
|
||||
/* Begin user dialog at outer menu */
|
||||
while (1) {
|
||||
choice = scroll = curr = max = 0;
|
||||
|
@ -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.53 1996/04/28 00:37:36 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.54 1996/04/28 01:07:26 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -264,6 +264,7 @@ typedef struct _devPriv {
|
||||
|
||||
/*** Externs ***/
|
||||
extern int DebugFD; /* Where diagnostic output goes */
|
||||
extern Boolean Fake; /* Don't actually modify anything - testing */
|
||||
extern Boolean SystemWasInstalled; /* Did we install it? */
|
||||
extern Boolean RunningAsInit; /* Are we running stand-alone? */
|
||||
extern Boolean DialogActive; /* Is the dialog() stuff up? */
|
||||
|
@ -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.54 1996/04/28 01:07:27 jkh Exp $
|
||||
* $Id: system.c,v 1.55 1996/04/28 03:27:26 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -109,7 +109,12 @@ systemExecute(char *command)
|
||||
foo.c_cc[VERASE] = '\010';
|
||||
tcsetattr(0, TCSANOW, &foo);
|
||||
}
|
||||
status = system(command);
|
||||
if (!Fake)
|
||||
status = system(command);
|
||||
else {
|
||||
status = 0;
|
||||
msgDebug("systemExecute: Faked execution of `%s'\n", command);
|
||||
}
|
||||
DialogActive = TRUE;
|
||||
return status;
|
||||
}
|
||||
@ -199,6 +204,10 @@ vsystem(char *fmt, ...)
|
||||
va_end(args);
|
||||
|
||||
omask = sigblock(sigmask(SIGCHLD));
|
||||
if (Fake) {
|
||||
msgDebug("vsystem: Faked execution of `%s'\n", cmd);
|
||||
return 0;
|
||||
}
|
||||
if (isDebug())
|
||||
msgDebug("Executing command `%s'\n", cmd);
|
||||
pid = fork();
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: wizard.c,v 1.6.2.1 1995/09/20 10:43:13 jkh Exp $
|
||||
* $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -208,7 +208,7 @@ slice_wizard(Disk *d)
|
||||
}
|
||||
if (!strcasecmp(*cmds,"write")) {
|
||||
printf("Write=%d\n",
|
||||
Write_Disk(d));
|
||||
Fake ? 0 : Write_Disk(d));
|
||||
Free_Disk(d);
|
||||
d = Open_Disk(d->name);
|
||||
continue;
|
||||
|
@ -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.26 1996/04/28 01:07:21 jkh Exp $
|
||||
* $Id: config.c,v 1.27 1996/04/28 03:26:46 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -581,16 +581,16 @@ configNFSServer(dialogMenuItem *self)
|
||||
"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));
|
||||
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");
|
||||
vsprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
|
||||
dialog_clear();
|
||||
systemExecute(cmd);
|
||||
restorescr(w);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: disks.c,v 1.43 1996/04/28 00:37:28 jkh Exp $
|
||||
* $Id: disks.c,v 1.44 1996/04/28 03:26:49 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -502,7 +502,7 @@ diskPartitionWrite(dialogMenuItem *self)
|
||||
|
||||
Set_Boot_Blocks(d, boot1, boot2);
|
||||
msgNotify("Writing partition information to drive %s", d->name);
|
||||
if (Write_Disk(d)) {
|
||||
if (!Fake && Write_Disk(d)) {
|
||||
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: ftp.c,v 1.14.2.1 1995/10/21 14:06:35 jkh Exp $
|
||||
* $Id: ftp.c,v 1.15 1995/12/07 10:33:47 peter Exp $
|
||||
*
|
||||
* Return values have been sanitized:
|
||||
* -1 error, but you (still) have a session.
|
||||
@ -49,9 +49,9 @@ debug(FTP_t ftp, const char *fmt, ...)
|
||||
va_start(ap, fmt);
|
||||
#ifdef STANDALONE_FTP
|
||||
strcpy(p,"LIBFTP: ");
|
||||
(void) vsnprintf(p+strlen(p), sizeof p - strlen(p), fmt, ap);
|
||||
(void) vsnprintf(p + strlen(p), sizeof p - strlen(p), fmt, ap);
|
||||
va_end(ap);
|
||||
write(ftp->fd_debug,p,strlen(p));
|
||||
write(ftp->fd_debug, p, strlen(p));
|
||||
#else
|
||||
if (isDebug()) {
|
||||
(void) vsnprintf(p, sizeof p - strlen(p), fmt, ap);
|
||||
@ -64,7 +64,7 @@ static int
|
||||
writes(int fd, char *s)
|
||||
{
|
||||
int i = strlen(s);
|
||||
if (i != write(fd,s,i))
|
||||
if (i != write(fd, s, i))
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
@ -76,14 +76,14 @@ get_a_line(FTP_t ftp)
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<BUFSIZ;) {
|
||||
j = read(ftp->fd_ctrl,buf+i,1);
|
||||
j = read(ftp->fd_ctrl, buf+i, 1);
|
||||
if (j != 1)
|
||||
return 0;
|
||||
if (buf[i] == '\r' || buf[i] == '\n') {
|
||||
if (!i)
|
||||
continue;
|
||||
buf[i] = '\0';
|
||||
debug(ftp, "received <%s>\n",buf);
|
||||
debug(ftp, "received <%s>\n", buf);
|
||||
return buf;
|
||||
}
|
||||
i++;
|
||||
@ -152,11 +152,11 @@ cmd(FTP_t ftp, const char *fmt, ...)
|
||||
(void) vsnprintf(p, sizeof p, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
debug(ftp, "send <%s>\n",p);
|
||||
debug(ftp, "send <%s>\n", p);
|
||||
strcat(p,"\r\n");
|
||||
if (writes(ftp->fd_ctrl,p))
|
||||
if (writes(ftp->fd_ctrl, p))
|
||||
return -2;
|
||||
i = get_a_number(ftp,0);
|
||||
i = get_a_number(ftp, 0);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -239,11 +239,12 @@ FtpOpen(FTP_t ftp, char *host, char *user, char *passwd)
|
||||
|
||||
debug(ftp, "open (%d)\n",get_a_number(ftp,0));
|
||||
|
||||
i = cmd(ftp,"USER %s",user);
|
||||
i = cmd(ftp, "USER %s", user);
|
||||
if (i >= 300 && i < 400)
|
||||
i = cmd(ftp,"PASS %s",passwd);
|
||||
if (i >= 299 || i < 0) {
|
||||
close(ftp->fd_ctrl); ftp->fd_ctrl = -1;
|
||||
close(ftp->fd_ctrl);
|
||||
ftp->fd_ctrl = -1;
|
||||
return zap(ftp);
|
||||
}
|
||||
ftp->state = isopen;
|
||||
@ -267,9 +268,10 @@ int
|
||||
FtpChdir(FTP_t ftp, char *dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ftp->state != isopen)
|
||||
return botch(ftp,"FtpChdir","open");
|
||||
i = cmd(ftp,"CWD %s",dir);
|
||||
i = cmd(ftp, "CWD %s", dir);
|
||||
if (i < 0)
|
||||
return i;
|
||||
else if (i != 250)
|
||||
@ -286,27 +288,27 @@ FtpGet(FTP_t ftp, char *file)
|
||||
struct sockaddr_in sin;
|
||||
u_long a;
|
||||
|
||||
debug(ftp, "FtpGet(ftp,%s)\n",file);
|
||||
debug(ftp, "FtpGet(ftp,%s)\n", file);
|
||||
if (ftp->state != isopen)
|
||||
return botch(ftp,"FtpGet","open");
|
||||
if(ftp->binary) {
|
||||
i = cmd(ftp,"TYPE I");
|
||||
return botch(ftp, "FtpGet", "open");
|
||||
if (ftp->binary) {
|
||||
i = cmd(ftp, "TYPE I");
|
||||
if (i < 0 || FTP_TIMEOUT(i))
|
||||
return zap(ftp);
|
||||
if (i > 299)
|
||||
return -1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
||||
if ((s = socket(ftp->addrtype, SOCK_STREAM, 0)) < 0)
|
||||
return zap(ftp);
|
||||
|
||||
if (ftp->passive) {
|
||||
debug(ftp, "send <%s>\n","PASV");
|
||||
if (writes(ftp->fd_ctrl,"PASV\r\n"))
|
||||
debug(ftp, "send <%s>\n", "PASV");
|
||||
if (writes(ftp->fd_ctrl, "PASV\r\n"))
|
||||
return zap(ftp);
|
||||
i = get_a_number(ftp,&q);
|
||||
i = get_a_number(ftp, &q);
|
||||
if (i < 0)
|
||||
return zap(ftp);
|
||||
if (i != 227)
|
||||
@ -316,14 +318,14 @@ FtpGet(FTP_t ftp, char *file)
|
||||
if (!*q)
|
||||
return zap(ftp);
|
||||
q--;
|
||||
for(i=0;i<6;i++) {
|
||||
for(i = 0; i < 6; i++) {
|
||||
q++;
|
||||
addr[i] = strtol(q,&q,10);
|
||||
addr[i] = strtol(q, &q, 10);
|
||||
}
|
||||
|
||||
sin.sin_family = ftp->addrtype;
|
||||
bcopy(addr, (char *)&sin.sin_addr, 4);
|
||||
bcopy(addr+4, (char *)&sin.sin_port, 2);
|
||||
bcopy(addr + 4, (char *)&sin.sin_port, 2);
|
||||
debug(ftp, "Opening active socket to %s : %u\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
|
||||
|
||||
debug(ftp, "Connecting to %s:%u\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
|
||||
@ -333,7 +335,7 @@ FtpGet(FTP_t ftp, char *file)
|
||||
return -1;
|
||||
}
|
||||
ftp->fd_xfer = s;
|
||||
i = cmd(ftp,"RETR %s",file);
|
||||
i = cmd(ftp,"RETR %s", file);
|
||||
if (i < 0 || FTP_TIMEOUT(i)) {
|
||||
close(s);
|
||||
return zap(ftp);
|
||||
@ -348,31 +350,31 @@ FtpGet(FTP_t ftp, char *file)
|
||||
return s;
|
||||
} else {
|
||||
i = sizeof sin;
|
||||
getsockname(ftp->fd_ctrl,(struct sockaddr *)&sin,&i);
|
||||
getsockname(ftp->fd_ctrl, (struct sockaddr *)&sin, &i);
|
||||
sin.sin_port = 0;
|
||||
i = sizeof sin;
|
||||
if (bind(s,(struct sockaddr *)&sin, i) < 0) {
|
||||
close (s);
|
||||
debug(ftp,"bind failed %d\n",errno);
|
||||
return zap(ftp);
|
||||
close (s);
|
||||
debug(ftp, "bind failed %d\n", errno);
|
||||
return zap(ftp);
|
||||
}
|
||||
getsockname(s,(struct sockaddr *)&sin,&i);
|
||||
if (listen(s,1) < 0) {
|
||||
close (s);
|
||||
debug(ftp,"listen failed %d\n",errno);
|
||||
return zap(ftp);
|
||||
getsockname(s, (struct sockaddr *)&sin, &i);
|
||||
if (listen(s, 1) < 0) {
|
||||
close (s);
|
||||
debug(ftp, "listen failed %d\n", errno);
|
||||
return zap(ftp);
|
||||
}
|
||||
a = ntohl(sin.sin_addr.s_addr);
|
||||
i = cmd(ftp,"PORT %d,%d,%d,%d,%d,%d",
|
||||
i = cmd(ftp, "PORT %d,%d,%d,%d,%d,%d",
|
||||
(a >> 24) & 0xff,
|
||||
(a >> 16) & 0xff,
|
||||
(a >> 8) & 0xff,
|
||||
a & 0xff,
|
||||
a & 0xff,
|
||||
(ntohs(sin.sin_port) >> 8) & 0xff,
|
||||
ntohs(sin.sin_port) & 0xff);
|
||||
ntohs(sin.sin_port) & 0xff);
|
||||
if (i != 200)
|
||||
return -1;
|
||||
i = cmd(ftp,"RETR %s",file);
|
||||
i = cmd(ftp,"RETR %s", file);
|
||||
if (i < 0) {
|
||||
close(s);
|
||||
return zap(ftp);
|
||||
@ -403,9 +405,10 @@ FtpEOF(FTP_t ftp)
|
||||
int i;
|
||||
|
||||
if (ftp->state != xfer)
|
||||
return botch(ftp,"FtpEOF","xfer");
|
||||
return botch(ftp, "FtpEOF", "xfer");
|
||||
debug(ftp, "FtpEOF(ftp)\n");
|
||||
close(ftp->fd_xfer); ftp->fd_xfer = -1;
|
||||
close(ftp->fd_xfer);
|
||||
ftp->fd_xfer = -1;
|
||||
ftp->state = isopen;
|
||||
i = get_a_number(ftp,0);
|
||||
if (i < 0)
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: globals.c,v 1.11 1995/12/07 10:33:50 peter Exp $
|
||||
* $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -41,14 +41,15 @@
|
||||
* whatever values we feel are appropriate.
|
||||
*/
|
||||
|
||||
int DebugFD; /* Where diagnostic output goes */
|
||||
int DebugFD; /* Where diagnostic output goes */
|
||||
Boolean Fake; /* Only pretend to be useful */
|
||||
Boolean RunningAsInit; /* Are we running as init? */
|
||||
Boolean DialogActive;
|
||||
Boolean ColorDisplay;
|
||||
Boolean OnVTY;
|
||||
Variable *VarHead; /* The head of the variable chain */
|
||||
Boolean DialogActive; /* Is libdialog initialized? */
|
||||
Boolean ColorDisplay; /* Are we on a color display? */
|
||||
Boolean OnVTY; /* Are we on a VTY? */
|
||||
Variable *VarHead; /* The head of the variable chain */
|
||||
Device *mediaDevice; /* Where we're installing from */
|
||||
int BootMgr;
|
||||
int BootMgr; /* Which boot manager we're using */
|
||||
|
||||
/*
|
||||
* Yes, I know some of these are already automatically initialized as
|
||||
@ -59,6 +60,7 @@ globalsInit(void)
|
||||
{
|
||||
DebugFD = -1;
|
||||
ColorDisplay = FALSE;
|
||||
Fake = FALSE;
|
||||
OnVTY = FALSE;
|
||||
DialogActive = FALSE;
|
||||
VarHead = NULL;
|
||||
|
@ -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.88 1996/04/28 01:07:22 jkh Exp $
|
||||
* $Id: install.c,v 1.89 1996/04/28 03:27:02 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -159,7 +159,8 @@ installInitial(void)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
if (!variable_get(DISK_LABELLED)) {
|
||||
msgConfirm("You need to assign disk labels before you can proceed with\nthe installation.");
|
||||
msgConfirm("You need to assign disk labels before you can proceed with\n"
|
||||
"the installation.");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
/* If it's labelled, assume it's also partitioned */
|
||||
@ -518,7 +519,7 @@ installFixup(dialogMenuItem *self)
|
||||
|
||||
if (!file_readable("/kernel")) {
|
||||
if (file_readable("/kernel.GENERIC")) {
|
||||
if (system("cp -p /kernel.GENERIC /kernel")) {
|
||||
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
|
||||
msgConfirm("Unable to link /kernel into place!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
@ -567,8 +568,8 @@ installFixup(dialogMenuItem *self)
|
||||
msgNotify("Fixing permissions..");
|
||||
/* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */
|
||||
if (directory_exists("/usr/X11R6")) {
|
||||
system("chmod -R a+r /usr/X11R6");
|
||||
system("find /usr/X11R6 -type d | xargs chmod a+x");
|
||||
vsystem("chmod -R a+r /usr/X11R6");
|
||||
vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
|
||||
}
|
||||
/* BOGON #2: We leave /etc in a bad state */
|
||||
chmod("/etc", 0755);
|
||||
@ -729,6 +730,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Initialize various user-settable values to their defaults */
|
||||
int
|
||||
installVarDefaults(dialogMenuItem *self)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: installUpgrade.c,v 1.22 1996/04/25 17:31:20 jkh Exp $
|
||||
* $Id: installUpgrade.c,v 1.23 1996/04/28 03:27:05 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -264,7 +264,10 @@ installUpgrade(dialogMenuItem *self)
|
||||
if (!rootExtract()) {
|
||||
msgConfirm("Failed to load the ROOT distribution. Please correct\n"
|
||||
"this problem and try again (the system will now reboot).");
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (extractingBin) {
|
||||
@ -284,13 +287,16 @@ installUpgrade(dialogMenuItem *self)
|
||||
(void)vsystem("cp -pr /etc/* %s", saved_etc);
|
||||
}
|
||||
if (file_readable("/kernel")) {
|
||||
msgNotify("Moving old kernel to /kernel.205");
|
||||
if (system("chflags noschg /kernel && mv /kernel /kernel.205")) {
|
||||
msgNotify("Moving old kernel to /kernel.prev");
|
||||
if (system("chflags noschg /kernel && mv /kernel /kernel.prev")) {
|
||||
if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n"
|
||||
"treat this as a big problem and abort the upgrade? Due to the\n"
|
||||
"way that this upgrade process works, you will have to reboot\n"
|
||||
"and start over from the beginning. Select Yes to reboot now")) {
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +309,10 @@ installUpgrade(dialogMenuItem *self)
|
||||
"should be considered a failure and started from the beginning, sorry!\n"
|
||||
"The system will reboot now.");
|
||||
dialog_clear();
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
msgConfirm("The extraction process seems to have had some problems, but we got most\n"
|
||||
"of the essentials. We'll treat this as a warning since it may have been\n"
|
||||
@ -359,9 +368,13 @@ installUpgrade(dialogMenuItem *self)
|
||||
msgDebug("Unable to get the terminal attributes!\n");
|
||||
printf("Well, good luck! When you're done, please type \"reboot\" or exit\n"
|
||||
"the shell to reboot the new system.\n");
|
||||
execlp("sh", "-sh", 0);
|
||||
if (!Fake)
|
||||
execlp("sh", "-sh", 0);
|
||||
else
|
||||
exit(0);
|
||||
msgDebug("Was unable to execute sh for post-upgrade shell!\n");
|
||||
reboot(0);
|
||||
if (RunningAsInit)
|
||||
reboot(0);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
@ -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: main.c,v 1.16 1996/04/07 03:52:31 jkh Exp $
|
||||
* $Id: main.c,v 1.17 1996/04/13 13:31:51 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -65,6 +65,15 @@ main(int argc, char **argv)
|
||||
/* Set up whatever things need setting up */
|
||||
systemInitialize(argc, argv);
|
||||
|
||||
/* Set default flag and variable values */
|
||||
installVarDefaults(NULL);
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-fake")) {
|
||||
variable_set2(VAR_DEBUG, "YES");
|
||||
Fake = TRUE;
|
||||
msgConfirm("I'll be just faking it from here on out, OK?");
|
||||
}
|
||||
|
||||
/* Try to preserve our scroll-back buffer */
|
||||
if (OnVTY)
|
||||
for (curr = 0; curr < 25; curr++)
|
||||
@ -73,9 +82,6 @@ main(int argc, char **argv)
|
||||
/* Probe for all relevant devices on the system */
|
||||
deviceGetAll();
|
||||
|
||||
/* Set default flag and variable values */
|
||||
installVarDefaults(NULL);
|
||||
|
||||
/* Begin user dialog at outer menu */
|
||||
while (1) {
|
||||
choice = scroll = curr = max = 0;
|
||||
|
@ -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: network.c,v 1.10 1996/04/13 13:32:03 jkh Exp $
|
||||
* $Id: network.c,v 1.11 1996/04/23 01:29:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -177,7 +177,7 @@ startPPP(Device *devp)
|
||||
int fd2;
|
||||
FILE *fp;
|
||||
char *val;
|
||||
pid_t pid;
|
||||
pid_t pid = 0;
|
||||
char myaddr[16], provider[16], speed[16];
|
||||
|
||||
/* These are needed to make ppp work */
|
||||
@ -233,7 +233,8 @@ startPPP(Device *devp)
|
||||
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
|
||||
return 0;
|
||||
}
|
||||
if (!(pid = fork())) {
|
||||
|
||||
if (!Fake && !(pid = fork())) {
|
||||
int i, fd;
|
||||
struct termios foo;
|
||||
extern int login_tty(int);
|
||||
|
@ -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.53 1996/04/28 00:37:36 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.54 1996/04/28 01:07:26 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -264,6 +264,7 @@ typedef struct _devPriv {
|
||||
|
||||
/*** Externs ***/
|
||||
extern int DebugFD; /* Where diagnostic output goes */
|
||||
extern Boolean Fake; /* Don't actually modify anything - testing */
|
||||
extern Boolean SystemWasInstalled; /* Did we install it? */
|
||||
extern Boolean RunningAsInit; /* Are we running stand-alone? */
|
||||
extern Boolean DialogActive; /* Is the dialog() stuff up? */
|
||||
|
@ -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.54 1996/04/28 01:07:27 jkh Exp $
|
||||
* $Id: system.c,v 1.55 1996/04/28 03:27:26 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -109,7 +109,12 @@ systemExecute(char *command)
|
||||
foo.c_cc[VERASE] = '\010';
|
||||
tcsetattr(0, TCSANOW, &foo);
|
||||
}
|
||||
status = system(command);
|
||||
if (!Fake)
|
||||
status = system(command);
|
||||
else {
|
||||
status = 0;
|
||||
msgDebug("systemExecute: Faked execution of `%s'\n", command);
|
||||
}
|
||||
DialogActive = TRUE;
|
||||
return status;
|
||||
}
|
||||
@ -199,6 +204,10 @@ vsystem(char *fmt, ...)
|
||||
va_end(args);
|
||||
|
||||
omask = sigblock(sigmask(SIGCHLD));
|
||||
if (Fake) {
|
||||
msgDebug("vsystem: Faked execution of `%s'\n", cmd);
|
||||
return 0;
|
||||
}
|
||||
if (isDebug())
|
||||
msgDebug("Executing command `%s'\n", cmd);
|
||||
pid = fork();
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: wizard.c,v 1.6.2.1 1995/09/20 10:43:13 jkh Exp $
|
||||
* $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -208,7 +208,7 @@ slice_wizard(Disk *d)
|
||||
}
|
||||
if (!strcasecmp(*cmds,"write")) {
|
||||
printf("Write=%d\n",
|
||||
Write_Disk(d));
|
||||
Fake ? 0 : Write_Disk(d));
|
||||
Free_Disk(d);
|
||||
d = Open_Disk(d->name);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user