summaryrefslogtreecommitdiff
path: root/src/parted-usb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/parted-usb.sh')
-rwxr-xr-xsrc/parted-usb.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/parted-usb.sh b/src/parted-usb.sh
index 730dc26..50fcb78 100755
--- a/src/parted-usb.sh
+++ b/src/parted-usb.sh
@@ -34,7 +34,7 @@ initialize_target()
34 if [ "$ROOTFS" ] 34 if [ "$ROOTFS" ]
35 then 35 then
36 get_rootfs_size 36 get_rootfs_size
37 fallocate -l $(($(KiB 17) + $(MiB $end_keys) + rootfs_size)) "$target" 37 fallocate -l $(($(KiB 17) + $(MiB $end_keys) + rootfs_size + $(KiB 640))) "$target"
38 else 38 else
39 fallocate -l $(($(KiB 17) + $(MiB $end_keys))) "$target" 39 fallocate -l $(($(KiB 17) + $(MiB $end_keys))) "$target"
40 fi 40 fi
@@ -74,6 +74,20 @@ make_target_bootable()
74 sync 74 sync
75} 75}
76 76
77copy_rootfs()
78{
79 if [ -z "$ROOTFS" ]
80 then
81 return
82 fi
83 [ -e "$ROOTFS" -a -b "$part"3 ]
84 get_rootfs_size
85 part_size=$(blockdev --getsize64 "$part"3)
86 [ "$rootfs_size" -le "$part_size" ] || die "rootfs_size=$rootfs_size > part_size=$part_size"
87
88 dd if="$ROOTFS" of="$part"3
89}
90
77acquire_target_block_devices() 91acquire_target_block_devices()
78{ 92{
79 if [ -b "$target" ] 93 if [ -b "$target" ]
@@ -143,6 +157,7 @@ globalize()
143 partition_target 157 partition_target
144 acquire_target_block_devices 158 acquire_target_block_devices
145 make_target_bootable 159 make_target_bootable
160 copy_rootfs
146} 161}
147 162
148sanity_checks() 163sanity_checks()