1#!/bin/sh 2 3set -e 4 5algorithm="aes-cbc-plain" 6key="jpwHgP1/XQDBijCBL+lgz85x9gdN2c3taqsol1aMyFY=" 7partition_size=255 8image_size=256 9write_offset=1 10 11rm -f partition.image disk.key disk.image 12echo $key | base64 -d > disk.key 13dd if=/dev/zero of=partition.image bs=512 count=0 seek=$partition_size 2>/dev/null 14 15sudo losetup -d /dev/loop7 2>/dev/null || true 16sudo losetup /dev/loop7 partition.image 17sudo cryptsetup open --type=plain --cipher=$algorithm --key-file=disk.key /dev/loop7 my_crypt 18sudo dd if=1K.bin of=/dev/mapper/my_crypt 19sudo cryptsetup close my_crypt 20sudo losetup -d /dev/loop7 2>/dev/null || true 21 22dd if=partition.image of=disk.image bs=512 seek=$write_offset 2>/dev/null 23 24echo 25echo "Add the following to the unit test" 26echo 27echo "base64_decodez >\$WORK/expected.img <<EOF" 28dd if=disk.image bs=512 count=$image_size 2>/dev/null | gzip -c | base64 29echo "EOF" 30 31rm -f partition.image disk.key disk.image 32