* Change sysinst MI code to use new install-target-filesystem access functions.
Add target.c to Makefiles. * Minor fixes: * Fix buglet in disks.c: make sure the target /etc exists before touching the target's /etc/fstab. (Could be even cleaner.) * If the target root is on /, don't copy our temporary /etc/resolv.conf to the target /etc/resolv.conf. (Could be even cleaner.) * Don't write the DNS hostname into /etc/defaultdomain. DNS search paths are often not the same as YP group names.
This commit is contained in:
parent
cd7def2863
commit
2d01e4dc90
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.3 1997/10/22 02:17:35 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.4 1997/11/02 08:20:47 jonathan Exp $
|
||||
#
|
||||
# Makefile for i386
|
||||
#
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
SRCS= menu_defs.c msg_defs.c main.c install.c upgrade.c \
|
||||
txtwalk.c run.c factor.c net.c disks.c util.c geom.c \
|
||||
md.c fdisk.c
|
||||
target.c md.c fdisk.c
|
||||
|
||||
fdisk.o md.o: menu_defs.h msg_defs.h
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.3 1997/10/22 02:17:49 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.4 1997/11/02 08:20:48 jonathan Exp $
|
||||
#
|
||||
# Makefile for pc532
|
||||
#
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
SRCS= menu_defs.c msg_defs.c main.c install.c upgrade.c \
|
||||
txtwalk.c run.c factor.c net.c disks.c util.c geom.c \
|
||||
md.c
|
||||
target.cmd.c
|
||||
|
||||
md.o: menu_defs.h msg_defs.h
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.1 1997/10/27 03:34:32 jonathan Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1997/11/02 08:20:49 jonathan Exp $
|
||||
#
|
||||
# Makefile for pmax
|
||||
#
|
||||
@ -6,8 +6,8 @@
|
||||
# have to have all of them here for crunch ...
|
||||
|
||||
SRCS= menu_defs.c msg_defs.c main.c install.c upgrade.c \
|
||||
txtwalk.c run.c factor.c net.c disks.c util.c geom.c \
|
||||
md.c
|
||||
txtwalk.c run.c factor.c net.c disks.c util.c geom.c \
|
||||
target.c md.c
|
||||
|
||||
md.o: menu_defs.h msg_defs.h
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: defs.h,v 1.11 1997/11/02 03:45:32 jonathan Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.12 1997/11/02 08:20:40 jonathan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -241,7 +241,13 @@ void cd_dist_dir __P((char *));
|
||||
void toggle_getit __P((int));
|
||||
void show_cur_distsets __P((void));
|
||||
void make_ramdisk_dir __P((const char *path));
|
||||
|
||||
/* from prefix.c */
|
||||
void make_target_dir __P((const char *path));
|
||||
void append_to_target_file __P((const char *string, const char *path));
|
||||
void echo_to_target_file __P((const char *string, const char *path));
|
||||
void append_to_target_file __P((const char *path, const char *string));
|
||||
void echo_to_target_file __P(( const char *path, const char *string));
|
||||
void sprintf_to_target_file __P(( const char *path, const char *fmt, ...));
|
||||
void trunc_target_file __P((const char *path));
|
||||
int target_chdir __P(( const char *path));
|
||||
void target_chdir_or_die __P((const char *dir));
|
||||
int target_already_root __P((void));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disks.c,v 1.7 1997/10/31 23:00:37 phil Exp $ */
|
||||
/* $NetBSD: disks.c,v 1.8 1997/11/02 08:20:42 jonathan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -55,10 +55,23 @@
|
||||
#include "menu_defs.h"
|
||||
#include "txtwalk.h"
|
||||
|
||||
/*
|
||||
* Default command to use for disklabel. Some ports may need to override this.
|
||||
*/
|
||||
#ifndef DISLABEL_CMD
|
||||
#if 1
|
||||
# define DISKLABEL_CMD "/sbin/disklabel -w -r" /* Works on i386. */
|
||||
#else
|
||||
# define DISKLABEL_CMD "/sbin/disklabel -w" /* On sun proms, -r loses. */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Local prototypes */
|
||||
static void get_disks (void);
|
||||
static void foundffs (struct data *list, int num);
|
||||
|
||||
|
||||
static void get_disks(void)
|
||||
{
|
||||
char **xd = disk_names;
|
||||
@ -252,9 +265,12 @@ void write_disklabel (void)
|
||||
{
|
||||
/* disklabel the disk */
|
||||
printf ("%s", msg_string (MSG_dodisklabel));
|
||||
run_prog ("/sbin/disklabel -w -r %s %s", diskdev, bsddiskname);
|
||||
run_prog_or_continue ("%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void make_filesystems (void)
|
||||
{
|
||||
int i;
|
||||
@ -263,17 +279,17 @@ void make_filesystems (void)
|
||||
printf ("%s", msg_string (MSG_donewfs));
|
||||
for (i=0; i<8; i++)
|
||||
if (bsdlabel[i][D_FSTYPE] == T_42BSD) {
|
||||
run_prog ("/sbin/newfs /dev/r%s%c", diskdev, 'a'+i);
|
||||
run_prog_or_continue ("/sbin/newfs /dev/r%s%c",
|
||||
diskdev, 'a'+i);
|
||||
if (*fsmount[i]) {
|
||||
if (i > 0) {
|
||||
run_prog ("/bin/mkdir /mnt%s",
|
||||
fsmount[i]);
|
||||
run_prog ("/sbin/mount -v /dev/%s%c"
|
||||
make_target_dir(fsmount[i]);
|
||||
run_prog_or_continue ("/sbin/mount -v /dev/%s%c"
|
||||
" /mnt%s",
|
||||
diskdev, 'a'+i,
|
||||
fsmount[i]);
|
||||
} else
|
||||
run_prog ("/sbin/mount -v /dev/%s%c"
|
||||
run_prog_or_continue ("/sbin/mount -v /dev/%s%c"
|
||||
" /mnt", diskdev, 'a'+i);
|
||||
}
|
||||
}
|
||||
@ -286,6 +302,7 @@ void make_fstab (void)
|
||||
int i;
|
||||
|
||||
/* Create the fstab. */
|
||||
make_target_dir("/etc");
|
||||
f = fopen ("/mnt/etc/fstab", "w");
|
||||
if (f == NULL) {
|
||||
#ifndef DEBUG
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: net.c,v 1.11 1997/10/30 00:03:34 phil Exp $ */
|
||||
/* $NetBSD: net.c,v 1.12 1997/11/02 08:20:44 jonathan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -89,6 +89,7 @@ int config_network (void)
|
||||
int pass;
|
||||
|
||||
FILE *f;
|
||||
time_t now;
|
||||
|
||||
if (network_up)
|
||||
return 1;
|
||||
@ -158,7 +159,9 @@ int config_network (void)
|
||||
(void)fprintf(stderr, "%s", msg_string(MSG_resolv));
|
||||
exit(1);
|
||||
}
|
||||
(void)fprintf (f, "nameserver %s\nlookup file bind\nsearch %s",
|
||||
time(&now);
|
||||
(void)fprintf (f, ";\n; BIND data file\n; Created by NetBSD sysinst on %s\n;\n", ctime(&now));
|
||||
(void)fprintf (f, "nameserver %s\nlookup file bind\nsearch %s\n",
|
||||
net_namesvr, net_domain);
|
||||
fclose (f);
|
||||
|
||||
@ -227,7 +230,7 @@ get_via_ftp (void)
|
||||
puts (CL); /* Just to make sure. */
|
||||
wrefresh (stdscr);
|
||||
#ifndef DEBUG
|
||||
chdir("/");
|
||||
chdir("/"); /* back to current real root */
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@ -264,19 +267,24 @@ void
|
||||
mnt_net_config(void)
|
||||
{
|
||||
char ans [5] = "y";
|
||||
char ifconfig_fn [STRSIZE];
|
||||
|
||||
if (network_up) {
|
||||
msg_prompt (MSG_mntnetconfig, ans, ans, 5);
|
||||
if (*ans == 'y') {
|
||||
run_prog ("/bin/cp /etc/resolv.conf /mnt/etc");
|
||||
run_prog ("echo %s > /mnt/etc/myname", net_host);
|
||||
run_prog ("echo %s %s >> /mnt/etc/hosts", net_ip,
|
||||
net_host);
|
||||
run_prog ("echo %s > /mnt/etc/defaultdomain",
|
||||
net_domain);
|
||||
run_prog ("echo %s netmask %s > /mnt/etc/ifconfig.%s",
|
||||
net_ip, net_mask, net_dev);
|
||||
run_prog ("echo %s > /mnt/etc/mygate", net_defroute);
|
||||
if (!target_already_root()) {
|
||||
run_prog ("/bin/cp /etc/resolv.conf /mnt/etc");
|
||||
}
|
||||
|
||||
sprintf_to_target_file (
|
||||
"/etc/hosts", "%s %s", net_ip, net_host);
|
||||
|
||||
snprintf (ifconfig_fn, STRSIZE,
|
||||
"/etc/ifconfig.%s", net_dev);
|
||||
sprintf_to_target_file (
|
||||
ifconfig_fn, "%s netmask %s", net_ip, net_mask);
|
||||
|
||||
echo_to_target_file ("/etc/mygate", net_defroute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: util.c,v 1.9 1997/10/31 23:00:50 phil Exp $ */
|
||||
/* $NetBSD: util.c,v 1.10 1997/11/02 08:20:45 jonathan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -39,6 +39,7 @@
|
||||
/* util.c -- routines that don't really fit anywhere else... */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -51,6 +52,7 @@
|
||||
#include "menu_defs.h"
|
||||
|
||||
|
||||
|
||||
void get_ramsize(void)
|
||||
{
|
||||
long len=sizeof(long);
|
||||
@ -122,17 +124,8 @@ extract_dist (void)
|
||||
}
|
||||
files[numchar] = '\0';
|
||||
|
||||
#ifndef DEBUG
|
||||
if (chdir("/mnt")) {
|
||||
endwin();
|
||||
(void)fprintf(stderr, msg_string(MSG_realdir), "/mnt");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
printf ("chdir (%s)\n", "/mnt");
|
||||
#endif
|
||||
target_chdir_or_die("/");
|
||||
|
||||
endwin();
|
||||
p = strtok (files, " \n");
|
||||
while (p != NULL) {
|
||||
(void)printf (msg_string(MSG_extracting), p);
|
||||
@ -151,15 +144,7 @@ void run_makedev (void)
|
||||
{
|
||||
msg_display (MSG_makedev);
|
||||
sleep (1);
|
||||
#ifndef DEBUG
|
||||
if (chdir("/mnt/dev")) {
|
||||
endwin();
|
||||
(void)fprintf(stderr, msg_string(MSG_realdir), "/mnt");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
printf ("chdir (%s)\n", "/mnt/dev");
|
||||
#endif
|
||||
target_chdir_or_die("/dev");
|
||||
run_prog ("/bin/sh MAKEDEV all");
|
||||
}
|
||||
|
||||
@ -222,7 +207,7 @@ int get_via_floppy (void)
|
||||
list++;
|
||||
}
|
||||
#ifndef DEBUG
|
||||
chdir("/");
|
||||
chdir("/"); /* back to current real root */
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@ -252,27 +237,17 @@ get_via_cdrom(void)
|
||||
|
||||
void cd_dist_dir (char *forwhat)
|
||||
{
|
||||
char realdir[STRSIZE];
|
||||
|
||||
/* ask user for the mountpoint. */
|
||||
msg_prompt (MSG_distdir, dist_dir, dist_dir, STRSIZE, forwhat);
|
||||
if (*dist_dir == '/')
|
||||
snprintf (realdir, STRSIZE, "/mnt%s", dist_dir);
|
||||
else
|
||||
snprintf (realdir, STRSIZE, "/mnt/%s", dist_dir);
|
||||
strcpy (dist_dir, realdir);
|
||||
run_prog ("/bin/mkdir %s", realdir);
|
||||
|
||||
/* make sure the directory exists. */
|
||||
make_target_dir(dist_dir);
|
||||
|
||||
clean_dist_dir = 1;
|
||||
#ifndef DEBUG
|
||||
if (chdir(realdir)) {
|
||||
endwin();
|
||||
(void)fprintf(stderr, msg_string(MSG_realdir), realdir);
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
printf ("chdir (%s)\n", realdir);
|
||||
#endif
|
||||
target_chdir_or_die(dist_dir);
|
||||
}
|
||||
|
||||
|
||||
/* Support for custom distribution fetches / unpacks. */
|
||||
|
||||
void toggle_getit (int num)
|
||||
@ -292,3 +267,4 @@ void show_cur_distsets (void)
|
||||
list++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user