diff options
Diffstat (limited to 'release/sysinstall')
-rw-r--r-- | release/sysinstall/Makefile | 2 | ||||
-rw-r--r-- | release/sysinstall/install.c | 68 | ||||
-rw-r--r-- | release/sysinstall/msg.c | 23 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 11 | ||||
-rw-r--r-- | release/sysinstall/system.c | 5 | ||||
-rw-r--r-- | release/sysinstall/termcap.c | 6 |
6 files changed, 94 insertions, 21 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile index 2a206eb..4aa36cc 100644 --- a/release/sysinstall/Makefile +++ b/release/sysinstall/Makefile @@ -8,7 +8,7 @@ SRCS= globals.c main.c dmenu.c menus.c \ misc.c msg.c system.c install.c \ termcap.c makedevs.c media.c variable.c \ devices.c dist.c lang.c wizard.c \ - disks.c + disks.c command.c CFLAGS += -Wall -g -I${.CURDIR}/../libdisk diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index a96a3ee..8f1ad5e 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.9 1995/05/06 09:34:18 jkh Exp $ + * $Id: install.c,v 1.10 1995/05/07 23:37:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,7 +42,10 @@ */ #include "sysinstall.h" -#include<sys/disklabel.h> +#include <sys/disklabel.h> +#include <sys/errno.h> +#include <sys/fcntl.h> +#include <unistd.h> Boolean SystemWasInstalled; @@ -86,7 +89,7 @@ installHook(char *str) if (!write_disks(disks)) { make_filesystems(disks); - cpio_extract(disks); + cpio_extract(); extract_dists(disks); install_configuration_files(disks); do_final_setup(disks); @@ -156,6 +159,7 @@ make_filesystems(struct disk **disks) { int i; + command_clear(); for (i = 0; disks[i]; i++) { struct chunk *c1; @@ -168,21 +172,69 @@ make_filesystems(struct disk **disks) while (c2) { if (c2->type == part && c2->subtype != FS_SWAP && - c2->private && ((PartInfo *)c2->private)->newfs) - vsystem("%s %s", ((PartInfo *)c2->private)->newfs_cmd, - c2->name); + c2->private) { + PartInfo *tmp = (PartInfo *)c2->private; + + if (tmp->newfs) + command_add(tmp->mountpoint, + "%s %s", tmp->newfs_cmd, c2->name); + command_add(tmp->mountpoint, + "mkdir -p /mnt/%s", tmp->mountpoint); + command_add(tmp->mountpoint, + "mount /mnt/dev/%s /mnt/%s", c2->name, + tmp->mountpoint); + } c2 = c2->next; } } c1 = c1->next; } } + command_sort(); + command_execute(); } void -cpio_extract(struct disk **disks) +cpio_extract(void) { - + int i, j, zpid, cpid, pfd[2]; + + while (CpioFD == -1) { + msgConfirm("Please Insert CPIO floppy in floppy drive 0"); + CpioFD = open("/dev/rfd0", O_RDONLY); + } + msgNotify("Extracting contents of CPIO floppy."); + pipe(pfd); + zpid = fork(); + if (!zpid) { + close(0); dup(CpioFD); close(CpioFD); + close(1); dup(pfd[1]); close(pfd[1]); + close(pfd[0]); + i = execl("/stand/gunzip", "/stand/gunzip", 0); + msgDebug("/stand/gunzip command returns %d status\n", i); + exit(i); + } + cpid = fork(); + if (!cpid) { + close(0); dup(pfd[0]); close(pfd[0]); + close(CpioFD); + close(pfd[1]); + close(1); open("/dev/null", O_WRONLY); + i = execl("/stand/cpio", "/stand/cpio", "-iduvm", 0); + msgDebug("/stand/cpio command returns %d status\n", i); + exit(i); + } + close(pfd[0]); + close(pfd[1]); + close(CpioFD); + i = wait(&j); + if (i < 0 || j) + msgFatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s", + i, j, cpid, zpid, strerror(errno)); + i = wait(&j); + if (i < 0 || j) + msgFatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s", + i, j, cpid, zpid, strerror(errno)); } void diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c index 70cf576..d8dc84b 100644 --- a/release/sysinstall/msg.c +++ b/release/sysinstall/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.7 1995/05/07 03:38:01 jkh Exp $ + * $Id: msg.c,v 1.8 1995/05/07 05:58:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -53,9 +53,8 @@ msgYap(char *fmt, ...) int attrs; errstr = (char *)safe_malloc(FILENAME_MAX); - errstr[0] = '\0'; va_start(args, fmt); - vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); + vsnprintf(errstr, FILENAME_MAX, fmt, args); va_end(args); attrs = getattrs(stdscr); attrset(A_REVERSE); @@ -74,9 +73,8 @@ msgInfo(char *fmt, ...) int attrs; errstr = (char *)safe_malloc(FILENAME_MAX); - errstr[0] = '\0'; va_start(args, fmt); - vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); + vsnprintf(errstr, FILENAME_MAX, fmt, args); va_end(args); attrs = getattrs(stdscr); attrset(A_NORMAL); @@ -240,3 +238,18 @@ msgGetInput(char *buf, char *fmt, ...) return NULL; } +/* Write something to the debugging port */ +void +msgDebug(char *fmt, ...) +{ + va_list args; + char *dbg; + + dbg = (char *)safe_malloc(FILENAME_MAX); + strcpy(dbg, "DEBUG: "); + va_start(args, fmt); + vsnprintf((char *)(dbg + strlen(dbg)), FILENAME_MAX, fmt, args); + va_end(args); + write(DebugFD, dbg, strlen(dbg)); + free(dbg); +} diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 68698a1..fad3398 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.10 1995/05/07 02:04:29 jkh Exp $ + * $Id: sysinstall.h,v 1.11 1995/05/07 23:37:34 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -203,6 +203,12 @@ extern unsigned int SrcDists; /* Which src distributions we want */ /*** Prototypes ***/ +/* command.c */ +extern void command_clear(void); +extern void command_sort(void); +extern void command_execute(void); +extern void command_add(char *key, char *fmt, ...); + /* globals.c */ extern void globalsInit(void); @@ -238,7 +244,7 @@ extern int vsystem(char *fmt, ...); extern void partition_disks(struct disk **disks); extern int write_disks(struct disk **disks); extern void make_filesystems(struct disk **disks); -extern void cpio_extract(struct disk **disks); +extern void cpio_extract(void); extern void extract_dists(struct disk **disks); extern void install_configuration_files(struct disk **disks); extern void do_final_setup(struct disk **disks); @@ -267,6 +273,7 @@ extern int set_termcap(void); extern void msgInfo(char *fmt, ...); extern void msgYap(char *fmt, ...); extern void msgWarn(char *fmt, ...); +extern void msgDebug(char *fmt, ...); extern void msgError(char *fmt, ...); extern void msgFatal(char *fmt, ...); extern void msgConfirm(char *fmt, ...); diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index d7783c2..4f1c643 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/system.c @@ -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.6 1995/05/06 09:34:22 jkh Exp $ + * $Id: system.c,v 1.7 1995/05/07 03:38:03 jkh Exp $ * * Jordan Hubbard * @@ -269,10 +269,11 @@ vsystem(char *fmt, ...) cmd = (char *)malloc(FILENAME_MAX); cmd[0] = '\0'; va_start(args, fmt); - vsnprintf((char *)(cmd + strlen(cmd)), FILENAME_MAX, fmt, args); + vsnprintf(cmd, FILENAME_MAX, fmt, args); va_end(args); msgNotify("Executing command: %s", cmd); i = system(cmd); + msgDebug("Command `%s' returns status of %d\n", cmd, i); free(cmd); return i; } diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c index 8b2a5f9..86e758a 100644 --- a/release/sysinstall/termcap.c +++ b/release/sysinstall/termcap.c @@ -42,19 +42,19 @@ set_termcap(void) return -1; if (setenv("TERMCAP", termcap_cons25, 1) < 0) return -1; - DebugFD = open("/dev/ttyv1",O_WRONLY); + DebugFD = open("/dev/ttyv1", O_WRONLY); OnVTY = TRUE; } else { if (setenv("TERM", "cons25-m", 1) < 0) return -1; if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) return -1; - DebugFD = open("/dev/ttyv1",O_WRONLY); + DebugFD = open("/dev/ttyv1", O_WRONLY); OnVTY = TRUE; } } else { - DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC,0644); + DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); } return 0; } |