Files
start-os/build/raspberry-pi/make-image.sh
Aiden McClelland 0ecd920ad9 feature: 0.3.2 -> 0.3.3 upgrade (#1958)
* 0.3.2 -> 0.3.3 upgrade script

* fix upgrade

* integrated image

* fix rip-image

* no U option on older rsync

* permissions and cleanup

* fixes

* label fs

* fix progress reporting

* only create rootfs for lite upgrade

* shrink image after creating

* fix for `blue` partitions
2022-11-29 09:43:54 -07:00

35 lines
719 B
Bash
Executable File

#!/bin/bash
set -e
function partition_for () {
if [[ "$1" =~ [0-9]+$ ]]; then
echo "$1p$2"
else
echo "$1$2"
fi
}
TARGET_NAME=embassyos-raspi.img
TARGET_SIZE=2400000000
cp raspios.img $TARGET_NAME
truncate -s $TARGET_SIZE $TARGET_NAME
(
echo d
echo 2
echo n
echo p
echo 2
echo 532480
echo
echo w
) | fdisk $TARGET_NAME
export OUTPUT_DEVICE=$(sudo losetup --show -fP $TARGET_NAME)
sudo e2fsck -f -y `partition_for ${OUTPUT_DEVICE} 2`
sudo resize2fs `partition_for ${OUTPUT_DEVICE} 2`
./build/raspberry-pi/write-image.sh
sudo e2fsck -f -y `partition_for ${OUTPUT_DEVICE} 2`
sudo resize2fs -M `partition_for ${OUTPUT_DEVICE} 2`
sudo losetup -d $OUTPUT_DEVICE