mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 13:37:40 +02:00
link image files
This commit is contained in:
parent
9e55f9c288
commit
8dd53982ea
@ -6,8 +6,8 @@ This addon can be used to easily up- and downgrade the RaspberryMatic system.
|
||||
|
||||
## Installation
|
||||
* Download adjusted RaspberryMatic image:
|
||||
* [RaspberryMatic-2.27.8.20170615-rpi0.rmupdate.img.zip](https://www.dropbox.com/s/cikwkap0e1yxly0/RaspberryMatic-2.27.8.20170615-rpi0.rmupdate.img.zip) SHA256 sum: 904edb9c4a565d65a9dfdd3ffe05ed4bc24f9f909b602d6de7cbcb5560418dfb
|
||||
* [RaspberryMatic-2.27.8.20170615-rpi3.rmupdate.img.zip](https://www.dropbox.com/s/6mzz9l6h4460we5/RaspberryMatic-2.27.8.20170615-rpi3.rmupdate.img.zip) SHA256 sum: c665667beb68d7d25b6f4210ea6c23471e1c0834ffc53a1abd2f917a9620322a
|
||||
* [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
|
||||
* 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
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
LOOP_DEV=7
|
||||
PART_START=512
|
||||
BOOT_SIZE=$((250*1024*1024))
|
||||
ROOT_SIZE=$((1000*1024*1024))
|
||||
USR_LOCAL_SIZE=$((2*1024*1024))
|
||||
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root." 1>&2
|
||||
exit 1
|
||||
@ -14,6 +14,8 @@ fi
|
||||
image_file="$(realpath $1)"
|
||||
new_image_file="${image_file/\.img/\.rmupdate\.img}"
|
||||
|
||||
[ $tinker == 1 ] && PART_START=$((906*512))
|
||||
|
||||
if [[ ! $image_file =~ .*\.img ]]; then
|
||||
echo "Not an image file: ${image_file}." 1>&2
|
||||
exit 1
|
||||
@ -26,11 +28,11 @@ 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))
|
||||
parted --script $new_image_file \
|
||||
mklabel msdos \
|
||||
mkpart primary fat32 512B ${BOOT_SIZE}B \
|
||||
mkpart primary fat32 ${PART_START}B ${BOOT_SIZE}B \
|
||||
set 1 boot on \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}))B \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100%
|
||||
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}+${ROOT_SIZE}+${ROOT_SIZE}))B 100%
|
||||
|
||||
echo "*** Copying original partitons ***"
|
||||
oIFS="$IFS"
|
||||
@ -44,8 +46,8 @@ for line in $(parted $image_file unit B print | grep primary); do
|
||||
echo $num - $start - $size
|
||||
seek=0
|
||||
[ "$num" = "1" ] && seek=$start
|
||||
[ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE})/512))
|
||||
[ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512))
|
||||
[ "$num" = "2" ] && seek=$(((${PART_START}+${BOOT_SIZE})/512))
|
||||
[ "$num" = "3" ] && seek=$(((${PART_START}+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512))
|
||||
dd if=$image_file of=$new_image_file bs=512 skip=$start count=$size seek=$seek conv=notrunc
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user