| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: md.c,v 1.2.4.2 2018/03/21 11:42:17 martin Exp $ */ | | 1 | /* $NetBSD: md.c,v 1.2.4.3 2018/10/30 10:14:21 sborrill 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. |
| @@ -41,43 +41,44 @@ | | | @@ -41,43 +41,44 @@ |
41 | #include <sys/utsname.h> | | 41 | #include <sys/utsname.h> |
42 | #include <stdio.h> | | 42 | #include <stdio.h> |
43 | #include <curses.h> | | 43 | #include <curses.h> |
44 | #include <unistd.h> | | 44 | #include <unistd.h> |
45 | #include <fcntl.h> | | 45 | #include <fcntl.h> |
46 | #include <util.h> | | 46 | #include <util.h> |
47 | #include <errno.h> | | 47 | #include <errno.h> |
48 | | | 48 | |
49 | #include "defs.h" | | 49 | #include "defs.h" |
50 | #include "md.h" | | 50 | #include "md.h" |
51 | #include "msg_defs.h" | | 51 | #include "msg_defs.h" |
52 | #include "menu_defs.h" | | 52 | #include "menu_defs.h" |
53 | | | 53 | |
54 | struct utsname instsys; | | | |
55 | | | 54 | |
56 | void | | 55 | void |
57 | md_init(void) | | 56 | md_init(void) |
58 | { | | 57 | { |
59 | } | | 58 | } |
60 | | | 59 | |
61 | void | | 60 | void |
62 | md_init_set_status(int flags) | | 61 | md_init_set_status(int flags) |
63 | { | | 62 | { |
| | | 63 | struct utsname instsys; |
| | | 64 | |
64 | (void)flags; | | 65 | (void)flags; |
65 | | | 66 | |
66 | /* | | 67 | /* |
67 | * Get the name of the Install Kernel we are running under and | | 68 | * Get the name of the Install Kernel we are running under and |
68 | * enable the installation of the corresponding GENERIC kernel. | | 69 | * enable the installation of the corresponding GENERIC kernel. |
69 | */ | | 70 | */ |
70 | uname(&instsys); | | 71 | uname(&instsys); |
71 | if (strstr(instsys.version, "(INSTALL32_IP3x")) | | 72 | if (strstr(instsys.version, "(INSTALL32_IP3x")) |
72 | set_kernel_set(SET_KERNEL_2); | | 73 | set_kernel_set(SET_KERNEL_2); |
73 | else if (strstr(instsys.version, "(INSTALL32_IP2x")) | | 74 | else if (strstr(instsys.version, "(INSTALL32_IP2x")) |
74 | set_kernel_set(SET_KERNEL_1); | | 75 | set_kernel_set(SET_KERNEL_1); |
75 | else if (strstr(instsys.version, "(GENERIC32_IP12")) | | 76 | else if (strstr(instsys.version, "(GENERIC32_IP12")) |
76 | set_kernel_set(SET_KERNEL_3); | | 77 | set_kernel_set(SET_KERNEL_3); |
77 | } | | 78 | } |
78 | | | 79 | |
79 | int | | 80 | int |
80 | md_get_info(void) | | 81 | md_get_info(void) |
81 | { | | 82 | { |
82 | struct disklabel disklabel; | | 83 | struct disklabel disklabel; |
83 | int fd; | | 84 | int fd; |
| @@ -146,27 +147,30 @@ md_check_partitions(void) | | | @@ -146,27 +147,30 @@ md_check_partitions(void) |
146 | */ | | 147 | */ |
147 | int | | 148 | int |
148 | md_pre_disklabel(void) | | 149 | md_pre_disklabel(void) |
149 | { | | 150 | { |
150 | return 0; | | 151 | return 0; |
151 | } | | 152 | } |
152 | | | 153 | |
153 | /* | | 154 | /* |
154 | * hook called after writing disklabel to new target disk. | | 155 | * hook called after writing disklabel to new target disk. |
155 | */ | | 156 | */ |
156 | int | | 157 | int |
157 | md_post_disklabel(void) | | 158 | md_post_disklabel(void) |
158 | { | | 159 | { |
159 | if (strstr(instsys.version, "(INSTALL32_IP3x")) | | 160 | struct utsname instsys; |
| | | 161 | uname(&instsys); |
| | | 162 | |
| | | 163 | if (strstr(instsys.version, "(INSTALL32_IP3x")) |
160 | return run_program(RUN_DISPLAY, | | 164 | return run_program(RUN_DISPLAY, |
161 | "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot", | | 165 | "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot", |
162 | pm->diskdev); | | 166 | pm->diskdev); |
163 | | | 167 | |
164 | if (strstr(instsys.version, "(INSTALL32_IP2x")) { | | 168 | if (strstr(instsys.version, "(INSTALL32_IP2x")) { |
165 | run_program(RUN_DISPLAY, | | 169 | run_program(RUN_DISPLAY, |
166 | "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot", | | 170 | "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot", |
167 | pm->diskdev); | | 171 | pm->diskdev); |
168 | return run_program(RUN_DISPLAY, | | 172 | return run_program(RUN_DISPLAY, |
169 | "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot", | | 173 | "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot", |
170 | pm->diskdev); | | 174 | pm->diskdev); |
171 | } | | 175 | } |
172 | | | 176 | |
| @@ -184,41 +188,44 @@ md_post_newfs(void) | | | @@ -184,41 +188,44 @@ md_post_newfs(void) |
184 | { | | 188 | { |
185 | return 0; | | 189 | return 0; |
186 | } | | 190 | } |
187 | | | 191 | |
188 | int | | 192 | int |
189 | md_post_extract(void) | | 193 | md_post_extract(void) |
190 | { | | 194 | { |
191 | return 0; | | 195 | return 0; |
192 | } | | 196 | } |
193 | | | 197 | |
194 | void | | 198 | void |
195 | md_cleanup_install(void) | | 199 | md_cleanup_install(void) |
196 | { | | 200 | { |
| | | 201 | struct utsname instsys; |
| | | 202 | |
197 | #ifndef DEBUG | | 203 | #ifndef DEBUG |
198 | enable_rc_conf(); | | 204 | enable_rc_conf(); |
199 | #endif | | 205 | #endif |
| | | 206 | uname(&instsys); |
200 | | | 207 | |
201 | if (strstr(instsys.version, "(GENERIC32_IP12")) | | 208 | if (strstr(instsys.version, "(GENERIC32_IP12")) |
202 | run_program(0, "/usr/mdec/sgivol -f -w netbsd %s %s", | | 209 | run_program(0, "/usr/mdec/sgivol -f -w netbsd %s %s", |
203 | target_expand("/netbsd.ecoff"), pm->diskdev); | | 210 | target_expand("/netbsd.ecoff"), pm->diskdev); |
204 | } | | 211 | } |
205 | | | 212 | |
206 | int | | 213 | int |
207 | md_pre_update(void) | | 214 | md_pre_update(void) |
208 | { | | 215 | { |
209 | return 1; | | 216 | return 1; |
210 | } | | 217 | } |
211 | | | 218 | |
212 | /* Upgrade support */ | | 219 | /* Upgrade support */ |
213 | int | | 220 | int |
214 | md_update(void) | | 221 | md_update(void) |
215 | { | | 222 | { |
216 | md_post_newfs(); | | 223 | md_post_disklabel(); |
217 | return 1; | | 224 | return 1; |
218 | } | | 225 | } |
219 | | | 226 | |
220 | int | | 227 | int |
221 | md_pre_mount() | | 228 | md_pre_mount() |
222 | { | | 229 | { |
223 | return 0; | | 230 | return 0; |
224 | } | | 231 | } |