add gpt checks

This commit is contained in:
parazyd 2016-10-12 13:58:06 +02:00
parent 60f168677b
commit 55637ebfb4
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
3 changed files with 20 additions and 9 deletions

View File

@ -21,7 +21,12 @@
build_image_dist() {
fn build_image_dist
req=(arch size parted_boot parted_root parted_type)
req=(arch size parted_type)
if [[ $parted_type = gpt ]]; then
req+=(gpt_boot gpt_root)
elif [[ $parted_type = dos ]]; then
req+=(parted_root parted_boot)
fi
req+=(workdir strapdir image_name)
ckreq || return 1

View File

@ -64,13 +64,17 @@ image_partition_raw_gpt() {
notice "partitioning raw gpt image..."
parted $workdir/${image_name}.img --script -- mklabel gpt
cgpt create -z ${image_name}.img
cgpt create ${image_name}.img
cgpt add -i 1 -t kernel -b ${gpt_boot[1]} -s ${gpt_boot[2]} \
-l kernel -S 1 -T 5 -P 10 ${image_name}.img
cgpt add -i 2 -t data -b ${gpt_root[1]} -s $(expr $(cgpt show ${image_name}.img \
| awk '/Sec GPT table/ {print \$1}') - ${gpt_root[1]}) -l Root ${image_name}.img
parted $workdir/${image_name}.img --script -- mklabel gpt || zerr
cgpt create -z $workdir/${image_name}.img || zerr
cgpt create $workdir/${image_name}.img || zerr
cgpt add -i 1 -t kernel -b ${gpt_boot[1]} \
-s ${gpt_boot[2]} \
-l kernel -S 1 -T 5 -P 10 $workdir/${image_name}.img
cgpt add -i 2 -t data -b ${gpt_root[1]} \
-s $(expr $(cgpt show $workdir/${image_name}.img | awk '/Sec GPT table/ {print $1}') - ${gpt_root[1]}) \
-l Root $workdir/${image_name}.img
findloopmapp

View File

@ -30,7 +30,9 @@ rsync_to_raw_image() {
pushd $strapdir
sudo rm -f .done
sudo rsync -HPavz -q --exclude={./boot} ./* $workdir/root
sudo rsync -HPavz -q ./boot/* $workdir/boot
if [[ $parted_type = dos ]]; then
sudo rsync -HPavz -q ./boot/* $workdir/boot
fi
popd
image_raw_umount