diff --git a/README.md b/README.md index 5d21c12..cb3f2ad 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ This addon can be used to easily up- and downgrade the RaspberryMatic system. ## Installation * Download adjusted RaspberryMatic image: - * [RaspberryMatic-2.31.25.20180120-rpi0.rmupdate.img.zip](https://www.dropbox.com/s/cath33kfhvyj5fh/RaspberryMatic-2.31.25.20180120-rpi0.rmupdate.img.zip) SHA256 sum: 6b8b4cfebadf27606205b077cdd2160cb7271c133a64604ab19b7109ff595191 - * [RaspberryMatic-2.31.25.20180120-rpi3.rmupdate.img.zip](https://www.dropbox.com/s/lk9thxla660pmje/RaspberryMatic-2.31.25.20180120-rpi3.rmupdate.img.zip) SHA256 sum: e51b93e3c84ae40dfaef2c14e91e4691f423e3d3dc4be3d4e5e5137ab0192016 + * [RaspberryMatic-2.31.25.20180120-rpi0.rmupdate.img.zip](https://www.dropbox.com/s/zvtdsky7975b77c/RaspberryMatic-2.31.25.20180120-rpi0.rmupdate.img.zip) SHA256 sum: 8861c94201080438aa12a1a175976037eec10754d15fb40604dc2ff7de351094 + * [RaspberryMatic-2.31.25.20180120-rpi3.rmupdate.img.zip](https://www.dropbox.com/s/js9exepqj4mvfok/RaspberryMatic-2.31.25.20180120-rpi3.rmupdate.img.zip) SHA256 sum: 83877c057deb68026283d71512c1da0780f747cc98fa89e898af584d3b079371 * Install adjusted RaspberryMatic image like described at [RaspberryMatic project](https://github.com/jens-maus/RaspberryMatic) * Download [addon package](https://github.com/j-a-n/raspberrymatic-addon-rmupdate/raw/master/rmupdate.tar.gz) * Install addon package on RaspberryMatic via system control diff --git a/adjust_image.sh b/adjust_image.sh index f13751a..3abe6bc 100755 --- a/adjust_image.sh +++ b/adjust_image.sh @@ -3,7 +3,7 @@ LOOP_DEV=7 BOOT_SIZE=$((250*1024*1024)) ROOT_SIZE=$((1000*1024*1024)) -USR_LOCAL_SIZE=$((2*1024*1024)) +USR_LOCAL_SIZE=$((4*1024*1024)) if [[ $EUID -ne 0 ]]; then echo "This script must be run as root." 1>&2 @@ -28,13 +28,14 @@ echo "image: ${image_file}" echo "adjusted image: ${new_image_file}" echo "*** Creating new image file and partitions ***" -dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1)) +dd if=/dev/zero of=$new_image_file bs=512 count=$(( ((${part_start}+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/512) )) + parted --script $new_image_file \ mklabel msdos \ - mkpart primary fat32 ${part_start}B ${BOOT_SIZE}B \ + mkpart primary fat32 ${part_start}B $((${part_start}+${BOOT_SIZE}-512))B \ set 1 boot on \ - mkpart primary ext4 $((${part_start}+${BOOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}))B \ - mkpart primary ext4 $((${part_start}+${BOOT_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \ + mkpart primary ext4 $((${part_start}+${BOOT_SIZE}))B $((${part_start}+${BOOT_SIZE}+${ROOT_SIZE}-512))B \ + mkpart primary ext4 $((${part_start}+${BOOT_SIZE}+${ROOT_SIZE}))B $((${part_start}+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}-512))B \ mkpart primary ext4 $((${part_start}+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100% echo "*** Copying original partitons ***" @@ -107,12 +108,18 @@ rmdir /tmp/rmupdate.mnt #fatresize --size $BOOT_SIZE /dev/mapper/loop${LOOP_DEV}p1 sleep 3 + +echo "resize /dev/mapper/loop${LOOP_DEV}p2" fsck.ext4 -f -y /dev/mapper/loop${LOOP_DEV}p2 || true resize2fs /dev/mapper/loop${LOOP_DEV}p2 tune2fs -L rootfs1 /dev/mapper/loop${LOOP_DEV}p2 sleep 3 + +echo "mkfs /dev/mapper/loop${LOOP_DEV}p3" mkfs.ext4 -L rootfs2 /dev/mapper/loop${LOOP_DEV}p3 || true sleep 3 + +echo "resize /dev/mapper/loop${LOOP_DEV}p4" fsck.ext4 -f -y /dev/mapper/loop${LOOP_DEV}p4 || true resize2fs /dev/mapper/loop${LOOP_DEV}p4