1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
Index: bootadm/usr/src/cmd/boot/bootadm/bootadm.c
===================================================================
--- bootadm.orig/usr/src/cmd/boot/bootadm/bootadm.c 2013-01-02 16:04:48.857015820 +0400
+++ bootadm/usr/src/cmd/boot/bootadm/bootadm.c 2013-01-02 16:06:08.556956182 +0400
@@ -3370,63 +3370,14 @@
struct stat sb;
int ret, what, status = BAM_SUCCESS;
- /* If there is mkisofs, use it to create the required archives */
- if (is_mkisofs()) {
- what = is_amd64() ? FILE64 : FILE32;
- if (has_cachedir(what) && is_dir_flag_on(what,
- NEED_UPDATE)) {
- ret = mkisofs_archive(root, what);
- if (ret != 0)
- status = BAM_ERROR;
- }
- return (status);
- }
-
- /*
- * Else setup command args for create_ramdisk.ksh for the UFS archives
- */
- if (bam_verbose)
- bam_print("mkisofs not found, creating UFS archive\n");
-
- (void) snprintf(path, sizeof (path), "%s/%s", root, CREATE_RAMDISK);
- if (stat(path, &sb) != 0) {
- bam_error(ARCH_EXEC_MISS, path, strerror(errno));
- return (BAM_ERROR);
- }
-
- if (is_safe_exec(path) == BAM_ERROR)
- return (BAM_ERROR);
-
- len = strlen(path) + strlen(root) + 10; /* room for space + -R */
- if (bam_alt_platform)
- len += strlen(bam_platform) + strlen("-p ");
- cmdline = s_calloc(1, len);
-
- if (bam_alt_platform) {
- assert(strlen(root) > 1);
- (void) snprintf(cmdline, len, "%s -p %s -R %s",
- path, bam_platform, root);
- /* chop off / at the end */
- cmdline[strlen(cmdline) - 1] = '\0';
- } else if (strlen(root) > 1) {
- (void) snprintf(cmdline, len, "%s -R %s", path, root);
- /* chop off / at the end */
- cmdline[strlen(cmdline) - 1] = '\0';
- } else
- (void) snprintf(cmdline, len, "%s", path);
-
- if (exec_cmd(cmdline, NULL) != 0) {
- bam_error(ARCHIVE_FAIL, cmdline);
- free(cmdline);
- return (BAM_ERROR);
- }
- free(cmdline);
- /*
- * The existence of the expected archives used to be
- * verified here. This check is done in create_ramdisk as
- * it needs to be in sync with the altroot operated upon.
- */
- return (BAM_SUCCESS);
+ what = is_amd64() ? FILE64 : FILE32;
+ if (has_cachedir(what) && is_dir_flag_on(what, NEED_UPDATE))
+ {
+ ret = mkisofs_archive(root, what);
+ if (ret != 0)
+ status = BAM_ERROR;
+ }
+ return (status);
}
/*
@@ -3501,25 +3452,6 @@
static int
is_boot_archive(char *root)
{
- char path[PATH_MAX];
- struct stat sb;
- int error;
- const char *fcn = "is_boot_archive()";
-
- /*
- * We can't create an archive without the create_ramdisk script
- */
- (void) snprintf(path, sizeof (path), "%s/%s", root, CREATE_RAMDISK);
- error = stat(path, &sb);
- INJECT_ERROR1("NOT_ARCHIVE_BASED", error = -1);
- if (error == -1) {
- if (bam_verbose)
- bam_print(FILE_MISS, path);
- BAM_DPRINTF((D_NOT_ARCHIVE_BOOT, fcn, root));
- return (0);
- }
-
- BAM_DPRINTF((D_IS_ARCHIVE_BOOT, fcn, root));
return (1);
}
@@ -3977,58 +3909,6 @@
*/
if (update_archive(root, opt) != BAM_SUCCESS)
ret = BAM_ERROR;
-
- if (ret == BAM_ERROR)
- goto out;
-
- /*
- * Now walk the mount table, performing archive update
- * for all mounted Newboot root filesystems
- */
- fp = fopen(MNTTAB, "r");
- if (fp == NULL) {
- bam_error(OPEN_FAIL, MNTTAB, strerror(errno));
- ret = BAM_ERROR;
- goto out;
- }
-
- resetmnttab(fp);
-
- while (getextmntent(fp, &mnt, sizeof (mnt)) == 0) {
- if (mnt.mnt_special == NULL)
- continue;
- if ((strcmp(mnt.mnt_fstype, MNTTYPE_ZFS) != 0) &&
- (strncmp(mnt.mnt_special, "/dev/", strlen("/dev/")) != 0))
- continue;
- if (strcmp(mnt.mnt_mountp, "/") == 0)
- continue;
-
- (void) snprintf(creatram, sizeof (creatram), "%s/%s",
- mnt.mnt_mountp, CREATE_RAMDISK);
-
- if (stat(creatram, &sb) == -1)
- continue;
-
- /*
- * We put a trailing slash to be consistent with root = "/"
- * case, such that we don't have to print // in some cases.
- */
- (void) snprintf(rootbuf, sizeof (rootbuf), "%s/",
- mnt.mnt_mountp);
- bam_rootlen = strlen(rootbuf);
-
- /*
- * It's possible that other mounts may be an alternate boot
- * architecture, so check it again.
- */
- if ((get_boot_cap(rootbuf) != BAM_SUCCESS) ||
- (update_archive(rootbuf, opt) != BAM_SUCCESS))
- ret = BAM_ERROR;
- }
-
- (void) fclose(fp);
-
-out:
/*
* We no longer use biosdev for Live Upgrade. Hence
* there is no need to defer (to shutdown time) any fdisk
|