diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/partvi | 42 |
1 files changed, 41 insertions, 1 deletions
@@ -79,6 +79,7 @@ do | |||
79 | case "$type" in | 79 | case "$type" in |
80 | efi-system-partition|bios-grub|samizdat-*) ;; | 80 | efi-system-partition|bios-grub|samizdat-*) ;; |
81 | dm-verity-hashes|dm-verity-data) require_var data_path ;; | 81 | dm-verity-hashes|dm-verity-data) require_var data_path ;; |
82 | partition-table) ;; | ||
82 | *) die "invalid type: $type" ;; | 83 | *) die "invalid type: $type" ;; |
83 | esac | 84 | esac |
84 | 85 | ||
@@ -129,9 +130,48 @@ do | |||
129 | cp -f -T --reflink "$data_path".verity "$builddir"/"$partuuid" | 130 | cp -f -T --reflink "$data_path".verity "$builddir"/"$partuuid" |
130 | ln -sfT "$partuuid" "$tmp" | 131 | ln -sfT "$partuuid" "$tmp" |
131 | ;; | 132 | ;; |
132 | *) die "Unrecognized type: $type" ;; | ||
133 | esac | 133 | esac |
134 | mv -T "$tmp" "$imgfile" | 134 | mv -T "$tmp" "$imgfile" |
135 | notice "Successfully wrote $imgfile" | 135 | notice "Successfully wrote $imgfile" |
136 | fi | 136 | fi |
137 | done | 137 | done |
138 | |||
139 | if [ "$UID" = 0 ] | ||
140 | then sudo= | ||
141 | else sudo=sudo | ||
142 | fi | ||
143 | |||
144 | map_name=samline | ||
145 | |||
146 | quietly() | ||
147 | { | ||
148 | "$@" >/dev/null 2>&1 || true | ||
149 | } | ||
150 | |||
151 | quietly $sudo dmsetup remove "$map_name" | ||
152 | quietly $sudo losetup -D | ||
153 | |||
154 | start=0 | ||
155 | map=$builddir/dmsetup.map | ||
156 | : > "$map" | ||
157 | |||
158 | for f in part*.conf | ||
159 | do | ||
160 | part=$builddir/${f%.conf} | ||
161 | if [ -h "$part" ] | ||
162 | then | ||
163 | partuuid=$(readlink -e "$part") | ||
164 | else | ||
165 | partuuid= | ||
166 | fi | ||
167 | #stat -L --format="$part %s" "$part" | ||
168 | $sudo losetup -L -f "$part" | ||
169 | dev=$(losetup -j "$part" -O NAME --noheadings) | ||
170 | devsz=$($sudo blockdev --getsz $dev) | ||
171 | printf '%d %d linear %s 0\n' $start $devsz "$dev" >> "$map" | ||
172 | start=$((start + devsz)) | ||
173 | |||
174 | done | ||
175 | $sudo dmsetup -v create "$map_name" "$map" | ||
176 | $sudo dmsetup remove "$map_name" | ||
177 | |||