Fri Jan 2 19:43:14 2015 UTC ()
Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


(abs)
diff -r1.5 -r1.6 src/usr.sbin/sysinst/defs.h
diff -r1.6 -r1.7 src/usr.sbin/sysinst/disks.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/install.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/upgrade.c
diff -r1.7 -r1.8 src/usr.sbin/sysinst/partman.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/arc/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/cobalt/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/evbsh3/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/hp300/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/hpcsh/md.c
diff -r1.4 -r1.5 src/usr.sbin/sysinst/arch/i386/md.c
diff -r1.3 -r1.4 src/usr.sbin/sysinst/arch/luna68k/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/mvme68k/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/news68k/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/sgimips/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/vax/md.c
diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/x68k/md.c

cvs diff -r1.5 -r1.6 src/usr.sbin/sysinst/defs.h (expand / switch to unified diff)

--- src/usr.sbin/sysinst/defs.h 2014/10/14 16:35:20 1.5
+++ src/usr.sbin/sysinst/defs.h 2015/01/02 19:43:13 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: defs.h,v 1.5 2014/10/14 16:35:20 christos Exp $ */ 1/* $NetBSD: defs.h,v 1.6 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Philip A. Nelson for Piermont Information Systems Inc. 7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -441,26 +441,27 @@ int md_update(void); @@ -441,26 +441,27 @@ int md_update(void);
441/* from main.c */ 441/* from main.c */
442void toplevel(void); 442void toplevel(void);
443 443
444/* from disks.c */ 444/* from disks.c */
445const char *get_default_cdrom(void); 445const char *get_default_cdrom(void);
446int find_disks(const char *); 446int find_disks(const char *);
447struct menudesc; 447struct menudesc;
448void fmt_fspart(struct menudesc *, int, void *); 448void fmt_fspart(struct menudesc *, int, void *);
449void disp_cur_fspart(int, int); 449void disp_cur_fspart(int, int);
450int write_disklabel(void); 450int write_disklabel(void);
451int make_filesystems(void); 451int make_filesystems(void);
452int make_fstab(void); 452int make_fstab(void);
453int mount_disks(void); 453int mount_disks(void);
 454int set_swap_if_low_ram(const char *, partinfo *);
454int set_swap(const char *, partinfo *); 455int set_swap(const char *, partinfo *);
455int check_swap(const char *, int); 456int check_swap(const char *, int);
456char *bootxx_name(void); 457char *bootxx_name(void);
457void label_read(void); 458void label_read(void);
458int get_dkwedges(struct dkwedge_info **, const char *); 459int get_dkwedges(struct dkwedge_info **, const char *);
459const char *get_gptfs_by_id(int); 460const char *get_gptfs_by_id(int);
460 461
461 462
462/* from disks_lfs.c */ 463/* from disks_lfs.c */
463int fs_is_lfs(void *); 464int fs_is_lfs(void *);
464 465
465/* from label.c */ 466/* from label.c */
466const char *get_last_mounted(int, int, partinfo *); 467const char *get_last_mounted(int, int, partinfo *);

cvs diff -r1.6 -r1.7 src/usr.sbin/sysinst/disks.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/disks.c 2014/12/28 12:05:27 1.6
+++ src/usr.sbin/sysinst/disks.c 2015/01/02 19:43:13 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: disks.c,v 1.6 2014/12/28 12:05:27 martin Exp $ */ 1/* $NetBSD: disks.c,v 1.7 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Philip A. Nelson for Piermont Information Systems Inc. 7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -1203,26 +1203,33 @@ mount_disks(void) @@ -1203,26 +1203,33 @@ mount_disks(void)
1203 if (fstabsize < 0) { 1203 if (fstabsize < 0) {
1204 /* error ! */ 1204 /* error ! */
1205 msg_display(MSG_badetcfstab, pm->diskdev); 1205 msg_display(MSG_badetcfstab, pm->diskdev);
1206 process_menu(MENU_ok, NULL); 1206 process_menu(MENU_ok, NULL);
1207 return -2; 1207 return -2;
1208 } 1208 }
1209 error = walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf); 1209 error = walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
1210 free(fstab); 1210 free(fstab);
1211 1211
1212 return error; 1212 return error;
1213} 1213}
1214 1214
1215int 1215int
 1216set_swap_if_low_ram(const char *disk, partinfo *pp) {
 1217 if (get_ramsize() <= 32)
 1218 return set_swap(disk, pp);
 1219 return 0;
 1220}
 1221
 1222int
1216set_swap(const char *disk, partinfo *pp) 1223set_swap(const char *disk, partinfo *pp)
1217{ 1224{
1218 int i; 1225 int i;
1219 char *cp; 1226 char *cp;
1220 int rval; 1227 int rval;
1221 1228
1222 if (pp == NULL) 1229 if (pp == NULL)
1223 pp = pm->oldlabel; 1230 pp = pm->oldlabel;
1224 1231
1225 for (i = 0; i < MAXPARTITIONS; i++) { 1232 for (i = 0; i < MAXPARTITIONS; i++) {
1226 if (pp[i].pi_fstype != FS_SWAP) 1233 if (pp[i].pi_fstype != FS_SWAP)
1227 continue; 1234 continue;
1228 asprintf(&cp, "/dev/%s%c", disk, 'a' + i); 1235 asprintf(&cp, "/dev/%s%c", disk, 'a' + i);

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/install.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/install.c 2014/08/03 16:09:38 1.2
+++ src/usr.sbin/sysinst/install.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: install.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */ 1/* $NetBSD: install.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Philip A. Nelson for Piermont Information Systems Inc. 7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -91,26 +91,27 @@ do_install(void) @@ -91,26 +91,27 @@ do_install(void)
91 return; 91 return;
92 } 92 }
93 93
94 /* Last chance ... do you really want to do this? */ 94 /* Last chance ... do you really want to do this? */
95 clear(); 95 clear();
96 refresh(); 96 refresh();
97 msg_display(MSG_lastchance, pm->diskdev); 97 msg_display(MSG_lastchance, pm->diskdev);
98 process_menu(MENU_noyes, NULL); 98 process_menu(MENU_noyes, NULL);
99 if (!yesno) 99 if (!yesno)
100 return; 100 return;
101 101
102 if (md_pre_disklabel() != 0 || 102 if (md_pre_disklabel() != 0 ||
103 write_disklabel() != 0 || 103 write_disklabel() != 0 ||
 104 set_swap_if_low_ram(pm->diskdev, pm->bsdlabel) != 0 ||
104 md_post_disklabel() != 0 || 105 md_post_disklabel() != 0 ||
105 make_filesystems() || 106 make_filesystems() ||
106 make_fstab() != 0 || 107 make_fstab() != 0 ||
107 md_post_newfs() != 0) 108 md_post_newfs() != 0)
108 return; 109 return;
109 } 110 }
110 111
111 /* Unpack the distribution. */ 112 /* Unpack the distribution. */
112 process_menu(MENU_distset, &retcode); 113 process_menu(MENU_distset, &retcode);
113 if (retcode == 0) 114 if (retcode == 0)
114 return; 115 return;
115 if (get_and_unpack_sets(0, MSG_disksetupdone, 116 if (get_and_unpack_sets(0, MSG_disksetupdone,
116 MSG_extractcomplete, MSG_abortinst) != 0) 117 MSG_extractcomplete, MSG_abortinst) != 0)

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/upgrade.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/upgrade.c 2014/08/03 16:09:38 1.2
+++ src/usr.sbin/sysinst/upgrade.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: upgrade.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */ 1/* $NetBSD: upgrade.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Philip A. Nelson for Piermont Information Systems Inc. 7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -57,26 +57,29 @@ do_upgrade(void) @@ -57,26 +57,29 @@ do_upgrade(void)
57 int retcode = 0; 57 int retcode = 0;
58 partman_go = 0; 58 partman_go = 0;
59 59
60 msg_display(MSG_upgradeusure); 60 msg_display(MSG_upgradeusure);
61 process_menu(MENU_noyes, NULL); 61 process_menu(MENU_noyes, NULL);
62 if (!yesno) 62 if (!yesno)
63 return; 63 return;
64 64
65 get_ramsize(); 65 get_ramsize();
66 66
67 if (find_disks(msg_string(MSG_upgrade)) < 0) 67 if (find_disks(msg_string(MSG_upgrade)) < 0)
68 return; 68 return;
69 69
 70 if (set_swap_if_low_ram(pm->diskdev, NULL) < 0)
 71 return;
 72
70 if (md_pre_update() < 0) 73 if (md_pre_update() < 0)
71 return; 74 return;
72 75
73 if (mount_disks() != 0) 76 if (mount_disks() != 0)
74 return; 77 return;
75 78
76 79
77 /* 80 /*
78 * Save X symlink, ... 81 * Save X symlink, ...
79 */ 82 */
80 if (save_X("/usr/X11R6")) 83 if (save_X("/usr/X11R6"))
81 return; 84 return;
82 if (save_X("/usr/X11R7")) 85 if (save_X("/usr/X11R7"))

cvs diff -r1.7 -r1.8 src/usr.sbin/sysinst/partman.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/partman.c 2014/10/18 08:33:31 1.7
+++ src/usr.sbin/sysinst/partman.c 2015/01/02 19:43:13 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: partman.c,v 1.7 2014/10/18 08:33:31 snj Exp $ */ 1/* $NetBSD: partman.c,v 1.8 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 2012 Eugene Lozovoy 4 * Copyright 2012 Eugene Lozovoy
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -2291,26 +2291,27 @@ pm_commit(menudesc *m, void *arg) @@ -2291,26 +2291,27 @@ pm_commit(menudesc *m, void *arg)
2291 if (pm_i->isspecial) { 2291 if (pm_i->isspecial) {
2292 if (make_filesystems() != 0) { 2292 if (make_filesystems() != 0) {
2293 if (logfp) 2293 if (logfp)
2294 fprintf(logfp, "Special disk %s preparing error\n", pm_i->diskdev); 2294 fprintf(logfp, "Special disk %s preparing error\n", pm_i->diskdev);
2295 continue; 2295 continue;
2296 } 2296 }
2297 pm_i->unsaved = 0; 2297 pm_i->unsaved = 0;
2298 } else if (! pm_i->gpt) { 2298 } else if (! pm_i->gpt) {
2299#ifndef NO_DISKLABEL 2299#ifndef NO_DISKLABEL
2300 savenewlabel(pm_i->bsdlabel, MAXPARTITIONS); 2300 savenewlabel(pm_i->bsdlabel, MAXPARTITIONS);
2301#endif 2301#endif
2302 if ( 2302 if (
2303 write_disklabel() != 0 || /* Write slices table (disklabel) */ 2303 write_disklabel() != 0 || /* Write slices table (disklabel) */
 2304 set_swap_if_low_ram(pm->diskdev, pm->bsdlabel) != 0 ||
2304 md_post_disklabel() != 0 || /* Enable swap and check badblock */ 2305 md_post_disklabel() != 0 || /* Enable swap and check badblock */
2305 make_filesystems() != 0 /* Create filesystems with newfs */ 2306 make_filesystems() != 0 /* Create filesystems with newfs */
2306 ) { 2307 ) {
2307 /* Oops, something failed... */ 2308 /* Oops, something failed... */
2308 if (logfp) 2309 if (logfp)
2309 fprintf(logfp, "Disk %s preparing error\n", pm_i->diskdev); 2310 fprintf(logfp, "Disk %s preparing error\n", pm_i->diskdev);
2310 continue; 2311 continue;
2311 } 2312 }
2312 pm_i->unsaved = 0; 2313 pm_i->unsaved = 0;
2313 } 2314 }
2314 } 2315 }
2315 2316
2316 /* Call all functions that may create new devices */ 2317 /* Call all functions that may create new devices */

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/arc/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/arc/md.c 2014/08/03 16:09:39 1.2
+++ src/usr.sbin/sysinst/arch/arc/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -237,28 +237,26 @@ md_pre_disklabel(void) @@ -237,28 +237,26 @@ md_pre_disklabel(void)
237 msg_display(MSG_wmbrfail); 237 msg_display(MSG_wmbrfail);
238 process_menu(MENU_ok, NULL); 238 process_menu(MENU_ok, NULL);
239 return 1; 239 return 1;
240 } 240 }
241 return 0; 241 return 0;
242} 242}
243 243
244/* 244/*
245 * hook called after writing disklabel to new target disk. 245 * hook called after writing disklabel to new target disk.
246 */ 246 */
247int 247int
248md_post_disklabel(void) 248md_post_disklabel(void)
249{ 249{
250 if (get_ramsize() <= 32) 
251 set_swap(pm->diskdev, pm->bsdlabel); 
252 return 0; 250 return 0;
253} 251}
254 252
255/* 253/*
256 * hook called after upgrade() or install() has finished setting 254 * hook called after upgrade() or install() has finished setting
257 * up the target disk but immediately before the user is given the 255 * up the target disk but immediately before the user is given the
258 * ``disks are now set up'' message. 256 * ``disks are now set up'' message.
259 */ 257 */
260int 258int
261md_post_newfs(void) 259md_post_newfs(void)
262{ 260{
263 if (!nobootfs) { 261 if (!nobootfs) {
264 msg_display(msg_string(MSG_copybootloader), pm->diskdev); 262 msg_display(msg_string(MSG_copybootloader), pm->diskdev);
@@ -281,29 +279,26 @@ md_cleanup_install(void) @@ -281,29 +279,26 @@ md_cleanup_install(void)
281 enable_rc_conf(); 279 enable_rc_conf();
282#endif 280#endif
283 msg_display(MSG_howtoboot); 281 msg_display(MSG_howtoboot);
284 process_menu(MENU_ok, NULL); 282 process_menu(MENU_ok, NULL);
285} 283}
286 284
287int 285int
288md_pre_update(void) 286md_pre_update(void)
289{ 287{
290 struct mbr_partition *part; 288 struct mbr_partition *part;
291 mbr_info_t *ext; 289 mbr_info_t *ext;
292 int i; 290 int i;
293 291
294 if (get_ramsize() <= 32) 
295 set_swap(pm->diskdev, NULL); 
296 
297 read_mbr(pm->diskdev, &mbr); 292 read_mbr(pm->diskdev, &mbr);
298 /* do a sanity check of the partition table */ 293 /* do a sanity check of the partition table */
299 for (ext = &mbr; ext; ext = ext->extended) { 294 for (ext = &mbr; ext; ext = ext->extended) {
300 part = ext->mbr.mbr_parts; 295 part = ext->mbr.mbr_parts;
301 for (i = 0; i < MBR_PART_COUNT; part++, i++) { 296 for (i = 0; i < MBR_PART_COUNT; part++, i++) {
302 if (part->mbrp_type != MBR_PTYPE_FAT12) 297 if (part->mbrp_type != MBR_PTYPE_FAT12)
303 continue; 298 continue;
304 if (part->mbrp_size < (MIN_FAT12_BOOT / 512)) { 299 if (part->mbrp_size < (MIN_FAT12_BOOT / 512)) {
305 msg_display(MSG_boottoosmall); 300 msg_display(MSG_boottoosmall);
306 msg_display_add(MSG_nobootpart, 0); 301 msg_display_add(MSG_nobootpart, 0);
307 process_menu(MENU_yesno, NULL); 302 process_menu(MENU_yesno, NULL);
308 if (!yesno) 303 if (!yesno)
309 return 0; 304 return 0;

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/cobalt/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/cobalt/md.c 2014/08/03 16:09:39 1.2
+++ src/usr.sbin/sysinst/arch/cobalt/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -238,29 +238,26 @@ md_pre_disklabel(void) @@ -238,29 +238,26 @@ md_pre_disklabel(void)
238 msg_display(MSG_wmbrfail); 238 msg_display(MSG_wmbrfail);
239 process_menu(MENU_ok, NULL); 239 process_menu(MENU_ok, NULL);
240 return 1; 240 return 1;
241 } 241 }
242 return 0; 242 return 0;
243} 243}
244 244
245/* 245/*
246 * hook called after writing disklabel to new target disk. 246 * hook called after writing disklabel to new target disk.
247 */ 247 */
248int 248int
249md_post_disklabel(void) 249md_post_disklabel(void)
250{ 250{
251 if (get_ramsize() <= 32) 
252 set_swap(pm->diskdev, pm->bsdlabel); 
253 
254 return 0; 251 return 0;
255} 252}
256 253
257/* 254/*
258 * hook called after upgrade() or install() has finished setting 255 * hook called after upgrade() or install() has finished setting
259 * up the target disk but immediately before the user is given the 256 * up the target disk but immediately before the user is given the
260 * ``disks are now set up'' message. 257 * ``disks are now set up'' message.
261 */ 258 */
262int 259int
263md_post_newfs(void) 260md_post_newfs(void)
264{ 261{
265 static const char *kernels[] = { 262 static const char *kernels[] = {
266 "vmlinux-nfsroot.gz", 263 "vmlinux-nfsroot.gz",
@@ -300,29 +297,26 @@ md_cleanup_install(void) @@ -300,29 +297,26 @@ md_cleanup_install(void)
300{ 297{
301#ifndef DEBUG 298#ifndef DEBUG
302 enable_rc_conf(); 299 enable_rc_conf();
303#endif 300#endif
304} 301}
305 302
306int 303int
307md_pre_update(void) 304md_pre_update(void)
308{ 305{
309 struct mbr_partition *part; 306 struct mbr_partition *part;
310 mbr_info_t *ext; 307 mbr_info_t *ext;
311 int i; 308 int i;
312 309
313 if (get_ramsize() <= 32) 
314 set_swap(pm->diskdev, NULL); 
315 
316 read_mbr(pm->diskdev, &mbr); 310 read_mbr(pm->diskdev, &mbr);
317 /* do a sanity check of the partition table */ 311 /* do a sanity check of the partition table */
318 for (ext = &mbr; ext; ext = ext->extended) { 312 for (ext = &mbr; ext; ext = ext->extended) {
319 part = ext->mbr.mbr_parts; 313 part = ext->mbr.mbr_parts;
320 for (i = 0; i < MBR_PART_COUNT; part++, i++) { 314 for (i = 0; i < MBR_PART_COUNT; part++, i++) {
321 if (part->mbrp_type != MBR_PTYPE_LNXEXT2) 315 if (part->mbrp_type != MBR_PTYPE_LNXEXT2)
322 continue; 316 continue;
323 if (part->mbrp_size < (MIN_EXT2FS_BOOT / 512)) { 317 if (part->mbrp_size < (MIN_EXT2FS_BOOT / 512)) {
324 msg_display(MSG_boottoosmall); 318 msg_display(MSG_boottoosmall);
325 msg_display_add(MSG_nobootpart, 0); 319 msg_display_add(MSG_nobootpart, 0);
326 process_menu(MENU_yesno, NULL); 320 process_menu(MENU_yesno, NULL);
327 if (!yesno) 321 if (!yesno)
328 return 0; 322 return 0;

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/evbsh3/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/evbsh3/md.c 2014/08/03 16:09:39 1.2
+++ src/usr.sbin/sysinst/arch/evbsh3/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -96,27 +96,26 @@ md_get_info(void) @@ -96,27 +96,26 @@ md_get_info(void)
96int 96int
97md_pre_disklabel(void) 97md_pre_disklabel(void)
98{ 98{
99 99
100 return 0; 100 return 0;
101} 101}
102 102
103/* 103/*
104 * hook called after writing disklabel to new target disk. 104 * hook called after writing disklabel to new target disk.
105 */ 105 */
106int 106int
107md_post_disklabel(void) 107md_post_disklabel(void)
108{ 108{
109 
110 return 0; 109 return 0;
111} 110}
112 111
113/* 112/*
114 * MD hook called after upgrade() or install() has finished setting 113 * MD hook called after upgrade() or install() has finished setting
115 * up the target disk but immediately before the user is given the 114 * up the target disk but immediately before the user is given the
116 * ``disks are now set up'' message, so that if power fails, they can 115 * ``disks are now set up'' message, so that if power fails, they can
117 * continue installation by booting the target disk and doing an 116 * continue installation by booting the target disk and doing an
118 * `upgrade'. 117 * `upgrade'.
119 */ 118 */
120int 119int
121md_post_newfs(void) 120md_post_newfs(void)
122{ 121{

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/hp300/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/hp300/md.c 2014/08/03 16:09:39 1.2
+++ src/usr.sbin/sysinst/arch/hp300/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -166,29 +166,26 @@ md_check_partitions(void) @@ -166,29 +166,26 @@ md_check_partitions(void)
166 */ 166 */
167int 167int
168md_pre_disklabel(void) 168md_pre_disklabel(void)
169{ 169{
170 return 0; 170 return 0;
171} 171}
172 172
173/* 173/*
174 * hook called after writing disklabel to new target disk. 174 * hook called after writing disklabel to new target disk.
175 */ 175 */
176int 176int
177md_post_disklabel(void) 177md_post_disklabel(void)
178{ 178{
179 if (get_ramsize() < 6) 
180 set_swap(pm->diskdev, pm->bsdlabel); 
181 
182 return 0; 179 return 0;
183} 180}
184 181
185/* 182/*
186 * hook called after upgrade() or install() has finished setting 183 * hook called after upgrade() or install() has finished setting
187 * up the target disk but immediately before the user is given the 184 * up the target disk but immediately before the user is given the
188 * ``disks are now set up'' message. 185 * ``disks are now set up'' message.
189 * 186 *
190 * On hp300, we use this opportunity to install the boot blocks. 187 * On hp300, we use this opportunity to install the boot blocks.
191 */ 188 */
192int 189int
193md_post_newfs(void) 190md_post_newfs(void)
194{ 191{
@@ -208,28 +205,26 @@ md_post_extract(void) @@ -208,28 +205,26 @@ md_post_extract(void)
208} 205}
209 206
210void 207void
211md_cleanup_install(void) 208md_cleanup_install(void)
212{ 209{
213#ifdef notyet /* sed is too large for ramdisk */ 210#ifdef notyet /* sed is too large for ramdisk */
214 enable_rc_conf(); 211 enable_rc_conf();
215#endif 212#endif
216} 213}
217 214
218int 215int
219md_pre_update(void) 216md_pre_update(void)
220{ 217{
221 if (get_ramsize() < 6) 
222 set_swap(pm->diskdev, NULL); 
223 return 1; 218 return 1;
224} 219}
225 220
226/* Upgrade support */ 221/* Upgrade support */
227int 222int
228md_update(void) 223md_update(void)
229{ 224{
230 md_post_newfs(); 225 md_post_newfs();
231 return 1; 226 return 1;
232} 227}
233 228
234/* 229/*
235 * Used in bsddisklabel.c as BOOT_SIZE 230 * Used in bsddisklabel.c as BOOT_SIZE

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/hpcsh/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/hpcsh/md.c 2014/08/03 16:09:39 1.2
+++ src/usr.sbin/sysinst/arch/hpcsh/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -100,27 +100,26 @@ md_pre_disklabel(void) @@ -100,27 +100,26 @@ md_pre_disklabel(void)
100 msg_display(MSG_wmbrfail); 100 msg_display(MSG_wmbrfail);
101 process_menu(MENU_ok, NULL); 101 process_menu(MENU_ok, NULL);
102 return 1; 102 return 1;
103 } 103 }
104 return 0; 104 return 0;
105} 105}
106 106
107/* 107/*
108 * hook called after writing disklabel to new target disk. 108 * hook called after writing disklabel to new target disk.
109 */ 109 */
110int 110int
111md_post_disklabel(void) 111md_post_disklabel(void)
112{ 112{
113 
114 return 0; 113 return 0;
115} 114}
116 115
117/* 116/*
118 * hook called after upgrade() or install() has finished setting 117 * hook called after upgrade() or install() has finished setting
119 * up the target disk but immediately before the user is given the 118 * up the target disk but immediately before the user is given the
120 * ``disks are now set up'' message. 119 * ``disks are now set up'' message.
121 */ 120 */
122int 121int
123md_post_newfs(void) 122md_post_newfs(void)
124{ 123{
125 124
126 return 0; 125 return 0;

cvs diff -r1.4 -r1.5 src/usr.sbin/sysinst/arch/i386/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/i386/md.c 2014/10/11 13:34:01 1.4
+++ src/usr.sbin/sysinst/arch/i386/md.c 2015/01/02 19:43:13 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.4 2014/10/11 13:34:01 gson Exp $ */ 1/* $NetBSD: md.c,v 1.5 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -275,29 +275,26 @@ md_pre_disklabel(void) @@ -275,29 +275,26 @@ md_pre_disklabel(void)
275 msg_display(MSG_wmbrfail); 275 msg_display(MSG_wmbrfail);
276 process_menu(MENU_ok, NULL); 276 process_menu(MENU_ok, NULL);
277 return 1; 277 return 1;
278 } 278 }
279 return 0; 279 return 0;
280} 280}
281 281
282/* 282/*
283 * hook called after writing disklabel to new target disk. 283 * hook called after writing disklabel to new target disk.
284 */ 284 */
285int 285int
286md_post_disklabel(void) 286md_post_disklabel(void)
287{ 287{
288 if (get_ramsize() <= 32) 
289 set_swap(pm->diskdev, pm->bsdlabel); 
290 
291 return 0; 288 return 0;
292} 289}
293 290
294/* 291/*
295 * hook called after upgrade() or install() has finished setting 292 * hook called after upgrade() or install() has finished setting
296 * up the target disk but immediately before the user is given the 293 * up the target disk but immediately before the user is given the
297 * ``disks are now set up'' message. 294 * ``disks are now set up'' message.
298 */ 295 */
299int 296int
300md_post_newfs(void) 297md_post_newfs(void)
301{ 298{
302 int ret; 299 int ret;
303 size_t len; 300 size_t len;
@@ -398,28 +395,26 @@ md_cleanup_install(void) @@ -398,28 +395,26 @@ md_cleanup_install(void)
398 "H;$!d;g;w /etc/wscons.conf' /etc/wscons.conf"); 395 "H;$!d;g;w /etc/wscons.conf' /etc/wscons.conf");
399 else 396 else
400# endif 397# endif
401 run_program(RUN_CHROOT, 398 run_program(RUN_CHROOT,
402 "sed -an -e '/^ttyE[1-9]/s/off/on/;" 399 "sed -an -e '/^ttyE[1-9]/s/off/on/;"
403 "H;$!d;g;w /etc/ttys' /etc/ttys"); 400 "H;$!d;g;w /etc/ttys' /etc/ttys");
404 401
405#endif 402#endif
406} 403}
407 404
408int 405int
409md_pre_update(void) 406md_pre_update(void)
410{ 407{
411 if (get_ramsize() <= 8) 
412 set_swap(pm->diskdev, NULL); 
413 return 1; 408 return 1;
414} 409}
415 410
416/* Upgrade support */ 411/* Upgrade support */
417int 412int
418md_update(void) 413md_update(void)
419{ 414{
420 md_post_newfs(); 415 md_post_newfs();
421 md_upgrade_mbrtype(); 416 md_upgrade_mbrtype();
422 return 1; 417 return 1;
423} 418}
424 419
425int 420int

cvs diff -r1.3 -r1.4 src/usr.sbin/sysinst/arch/luna68k/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/luna68k/md.c 2014/08/04 08:59:28 1.3
+++ src/usr.sbin/sysinst/arch/luna68k/md.c 2015/01/02 19:43:13 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.3 2014/08/04 08:59:28 martin Exp $ */ 1/* $NetBSD: md.c,v 1.4 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -144,30 +144,26 @@ md_check_partitions(void) @@ -144,30 +144,26 @@ md_check_partitions(void)
144int 144int
145md_pre_disklabel(void) 145md_pre_disklabel(void)
146{ 146{
147 147
148 return 0; 148 return 0;
149} 149}
150 150
151/* 151/*
152 * hook called after writing disklabel to new target disk. 152 * hook called after writing disklabel to new target disk.
153 */ 153 */
154int 154int
155md_post_disklabel(void) 155md_post_disklabel(void)
156{ 156{
157 
158 if (get_ramsize() <= 32) 
159 set_swap(pm->diskdev, pm->bsdlabel); 
160 
161 return 0; 157 return 0;
162} 158}
163 159
164static int 160static int
165copy_bootloader(void) 161copy_bootloader(void)
166{ 162{
167 const char *mntdir = "/mnt2"; 163 const char *mntdir = "/mnt2";
168 164
169 msg_display(MSG_copybootloader, pm->diskdev); 165 msg_display(MSG_copybootloader, pm->diskdev);
170 if (!run_program(RUN_SILENT | RUN_ERROR_OK, 166 if (!run_program(RUN_SILENT | RUN_ERROR_OK,
171 "mount /dev/%s%c %s", pm->diskdev, 'a' + PART_BOOT, mntdir)) { 167 "mount /dev/%s%c %s", pm->diskdev, 'a' + PART_BOOT, mntdir)) {
172 mnt2_mounted = 1; 168 mnt2_mounted = 1;
173 run_program(0, "/bin/cp /usr/mdec/boot %s", mntdir); 169 run_program(0, "/bin/cp /usr/mdec/boot %s", mntdir);
@@ -207,30 +203,26 @@ void @@ -207,30 +203,26 @@ void
207md_cleanup_install(void) 203md_cleanup_install(void)
208{ 204{
209 205
210#ifndef DEBUG 206#ifndef DEBUG
211 enable_rc_conf(); 207 enable_rc_conf();
212#endif 208#endif
213 msg_display(MSG_howtoboot); 209 msg_display(MSG_howtoboot);
214 process_menu(MENU_ok, NULL); 210 process_menu(MENU_ok, NULL);
215} 211}
216 212
217int 213int
218md_pre_update(void) 214md_pre_update(void)
219{ 215{
220 
221 if (get_ramsize() <= 32) 
222 set_swap(pm->diskdev, pm->bsdlabel); 
223 
224 return 1; 216 return 1;
225} 217}
226 218
227/* Upgrade support */ 219/* Upgrade support */
228int 220int
229md_update(void) 221md_update(void)
230{ 222{
231 const char *mntdir = "/mnt2"; 223 const char *mntdir = "/mnt2";
232 char bootpath[MAXPATHLEN]; 224 char bootpath[MAXPATHLEN];
233 struct stat sb; 225 struct stat sb;
234 bool hasboot = false; 226 bool hasboot = false;
235 227
236 /* 228 /*

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/mvme68k/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/mvme68k/md.c 2014/08/03 16:09:40 1.2
+++ src/usr.sbin/sysinst/arch/mvme68k/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -164,29 +164,26 @@ md_check_partitions(void) @@ -164,29 +164,26 @@ md_check_partitions(void)
164 */ 164 */
165int 165int
166md_pre_disklabel(void) 166md_pre_disklabel(void)
167{ 167{
168 return 0; 168 return 0;
169} 169}
170 170
171/* 171/*
172 * hook called after writing disklabel to new target disk. 172 * hook called after writing disklabel to new target disk.
173 */ 173 */
174int 174int
175md_post_disklabel(void) 175md_post_disklabel(void)
176{ 176{
177 if (get_ramsize() < 6) 
178 set_swap(pm->diskdev, pm->bsdlabel); 
179 
180 return 0; 177 return 0;
181} 178}
182 179
183/* 180/*
184 * hook called after upgrade() or install() has finished setting 181 * hook called after upgrade() or install() has finished setting
185 * up the target disk but immediately before the user is given the 182 * up the target disk but immediately before the user is given the
186 * ``disks are now set up'' message.. 183 * ``disks are now set up'' message..
187 * 184 *
188 * On mvme68k, we use this opportunity to install the boot blocks. 185 * On mvme68k, we use this opportunity to install the boot blocks.
189 */ 186 */
190int 187int
191md_post_newfs(void) 188md_post_newfs(void)
192{ 189{
@@ -209,28 +206,26 @@ md_post_extract(void) @@ -209,28 +206,26 @@ md_post_extract(void)
209} 206}
210 207
211void 208void
212md_cleanup_install(void) 209md_cleanup_install(void)
213{ 210{
214#ifdef notyet /* sed is too large for ramdisk */ 211#ifdef notyet /* sed is too large for ramdisk */
215 enable_rc_conf(); 212 enable_rc_conf();
216#endif 213#endif
217} 214}
218 215
219int 216int
220md_pre_update(void) 217md_pre_update(void)
221{ 218{
222 if (get_ramsize() < 6) 
223 set_swap(pm->diskdev, NULL); 
224 return 1; 219 return 1;
225} 220}
226 221
227/* Upgrade support */ 222/* Upgrade support */
228int 223int
229md_update(void) 224md_update(void)
230{ 225{
231 md_post_newfs(); 226 md_post_newfs();
232 return 1; 227 return 1;
233} 228}
234 229
235int 230int
236md_pre_mount() 231md_pre_mount()

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/news68k/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/news68k/md.c 2014/08/03 16:09:40 1.2
+++ src/usr.sbin/sysinst/arch/news68k/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -129,27 +129,26 @@ md_check_partitions(void) @@ -129,27 +129,26 @@ md_check_partitions(void)
129int 129int
130md_pre_disklabel(void) 130md_pre_disklabel(void)
131{ 131{
132 132
133 return 0; 133 return 0;
134} 134}
135 135
136/* 136/*
137 * hook called after writing disklabel to new target disk. 137 * hook called after writing disklabel to new target disk.
138 */ 138 */
139int 139int
140md_post_disklabel(void) 140md_post_disklabel(void)
141{ 141{
142 
143 return 0; 142 return 0;
144} 143}
145 144
146/* 145/*
147 * hook called after upgrade() or install() has finished setting 146 * hook called after upgrade() or install() has finished setting
148 * up the target disk but immediately before the user is given the 147 * up the target disk but immediately before the user is given the
149 * ``disks are now set up'' message. 148 * ``disks are now set up'' message.
150 * 149 *
151 * On the news68k, we use this opportunity to install the boot blocks. 150 * On the news68k, we use this opportunity to install the boot blocks.
152 */ 151 */
153int 152int
154md_post_newfs(void) 153md_post_newfs(void)
155{ 154{

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/sgimips/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/sgimips/md.c 2014/08/03 16:09:40 1.2
+++ src/usr.sbin/sysinst/arch/sgimips/md.c 2015/01/02 19:43:13 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -146,27 +146,26 @@ md_check_partitions(void) @@ -146,27 +146,26 @@ md_check_partitions(void)
146 */ 146 */
147int 147int
148md_pre_disklabel(void) 148md_pre_disklabel(void)
149{ 149{
150 return 0; 150 return 0;
151} 151}
152 152
153/* 153/*
154 * hook called after writing disklabel to new target disk. 154 * hook called after writing disklabel to new target disk.
155 */ 155 */
156int 156int
157md_post_disklabel(void) 157md_post_disklabel(void)
158{ 158{
159 set_swap(pm->diskdev, pm->bsdlabel); 
160 if (strstr(instsys.version, "(INSTALL32_IP3x)")) 159 if (strstr(instsys.version, "(INSTALL32_IP3x)"))
161 return run_program(RUN_DISPLAY, 160 return run_program(RUN_DISPLAY,
162 "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot", 161 "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
163 pm->diskdev); 162 pm->diskdev);
164 163
165 if (strstr(instsys.version, "(INSTALL32_IP2x)")) { 164 if (strstr(instsys.version, "(INSTALL32_IP2x)")) {
166 run_program(RUN_DISPLAY, 165 run_program(RUN_DISPLAY,
167 "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot", 166 "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
168 pm->diskdev); 167 pm->diskdev);
169 return run_program(RUN_DISPLAY, 168 return run_program(RUN_DISPLAY,
170 "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot", 169 "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot",
171 pm->diskdev); 170 pm->diskdev);
172 } 171 }

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/vax/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/vax/md.c 2014/08/03 16:09:41 1.2
+++ src/usr.sbin/sysinst/arch/vax/md.c 2015/01/02 19:43:14 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:14 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -133,29 +133,26 @@ md_check_partitions(void) @@ -133,29 +133,26 @@ md_check_partitions(void)
133 */ 133 */
134int 134int
135md_pre_disklabel(void) 135md_pre_disklabel(void)
136{ 136{
137 return 0; 137 return 0;
138} 138}
139 139
140/* 140/*
141 * hook called after writing disklabel to new target disk. 141 * hook called after writing disklabel to new target disk.
142 */ 142 */
143int 143int
144md_post_disklabel(void) 144md_post_disklabel(void)
145{ 145{
146 if (get_ramsize() <= 32) 
147 set_swap(pm->diskdev, pm->bsdlabel); 
148 
149 return 0; 146 return 0;
150} 147}
151 148
152/* 149/*
153 * hook called after upgrade() or install() has finished setting 150 * hook called after upgrade() or install() has finished setting
154 * up the target disk but immediately before the user is given the 151 * up the target disk but immediately before the user is given the
155 * ``disks are now set up'' message. 152 * ``disks are now set up'' message.
156 * 153 *
157 * On the vax, we use this opportunity to install the boot blocks. 154 * On the vax, we use this opportunity to install the boot blocks.
158 */ 155 */
159int 156int
160md_post_newfs(void) 157md_post_newfs(void)
161{ 158{
@@ -172,29 +169,26 @@ md_post_extract(void) @@ -172,29 +169,26 @@ md_post_extract(void)
172} 169}
173 170
174void 171void
175md_cleanup_install(void) 172md_cleanup_install(void)
176{ 173{
177#ifndef DEBUG 174#ifndef DEBUG
178 enable_rc_conf(); 175 enable_rc_conf();
179#endif 176#endif
180} 177}
181 178
182int 179int
183md_pre_update(void) 180md_pre_update(void)
184{ 181{
185 if (get_ramsize() <= 32) 
186 set_swap(pm->diskdev, NULL); 
187 
188 return 1; 182 return 1;
189} 183}
190 184
191/* Upgrade support */ 185/* Upgrade support */
192int 186int
193md_update(void) 187md_update(void)
194{ 188{
195 md_post_newfs(); 189 md_post_newfs();
196 return 1; 190 return 1;
197} 191}
198 192
199int 193int
200md_pre_mount() 194md_pre_mount()

cvs diff -r1.2 -r1.3 src/usr.sbin/sysinst/arch/x68k/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/x68k/md.c 2014/08/03 16:09:41 1.2
+++ src/usr.sbin/sysinst/arch/x68k/md.c 2015/01/02 19:43:14 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */ 1/* $NetBSD: md.c,v 1.3 2015/01/02 19:43:14 abs Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. Modified by Minoura Makoto for x68k. 8 * Systems Inc. Modified by Minoura Makoto for x68k.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -252,28 +252,26 @@ int @@ -252,28 +252,26 @@ int
252md_pre_disklabel(void) 252md_pre_disklabel(void)
253{ 253{
254 if (md_need_newdisk) 254 if (md_need_newdisk)
255 md_newdisk (); 255 md_newdisk ();
256 return 0; 256 return 0;
257} 257}
258 258
259/* 259/*
260 * hook called after writing disklabel to new target disk. 260 * hook called after writing disklabel to new target disk.
261 */ 261 */
262int 262int
263md_post_disklabel(void) 263md_post_disklabel(void)
264{ 264{
265 if (get_ramsize() < 6) 
266 set_swap(pm->diskdev, pm->bsdlabel); 
267 return 0; 265 return 0;
268} 266}
269 267
270/* 268/*
271 * hook called after upgrade() or install() has finished setting 269 * hook called after upgrade() or install() has finished setting
272 * up the target disk but immediately before the user is given the 270 * up the target disk but immediately before the user is given the
273 * ``disks are now set up'' message. 271 * ``disks are now set up'' message.
274 * 272 *
275 * On the x68k, we use this opportunity to install the boot blocks. 273 * On the x68k, we use this opportunity to install the boot blocks.
276 */ 274 */
277int 275int
278md_post_newfs(void) 276md_post_newfs(void)
279{ 277{
@@ -295,28 +293,26 @@ md_post_extract(void) @@ -295,28 +293,26 @@ md_post_extract(void)
295} 293}
296 294
297void 295void
298md_cleanup_install(void) 296md_cleanup_install(void)
299{ 297{
300#ifndef DEBUG 298#ifndef DEBUG
301 enable_rc_conf(); 299 enable_rc_conf();
302#endif 300#endif
303} 301}
304 302
305int 303int
306md_pre_update(void) 304md_pre_update(void)
307{ 305{
308 if (get_ramsize() < 6) 
309 set_swap(pm->diskdev, NULL); 
310 return 1; 306 return 1;
311} 307}
312 308
313/* Upgrade support */ 309/* Upgrade support */
314int 310int
315md_update(void) 311md_update(void)
316{ 312{
317 md_post_newfs(); 313 md_post_newfs();
318 return 1; 314 return 1;
319} 315}
320 316
321static int 317static int
322md_newdisk(void) 318md_newdisk(void)