From fedfc795e7348b48f56c935e9e902ecd4fae0420 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 15 Apr 2023 01:33:56 +0200 Subject: [PATCH] Verify extractor checksum --- install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ffd106b..fed2382 100644 --- a/install.sh +++ b/install.sh @@ -27,6 +27,12 @@ rm -rf $TMP && mkdir -p $TMP RD="$TMP/rd.gz" curl -r 64493568-69886247 -s -k -o "$RD" https://global.synologydownload.com/download/DSM/release/7.0.1/42218/DSM_VirtualDSM_42218.pat +SUM=($(md5sum $RD)) + +if [ $SUM != "14fb88cb7cabddb5af1d0269bf032845" ]; then + echo "Invalid extractor, checksum failed." && exit 59 +fi + set +e xz -dc <$RD >$TMP/rd 2>/dev/null (cd $TMP && cpio -idm <$TMP/rd 2>/dev/null) @@ -62,7 +68,7 @@ if ((SIZE<250000000)); then echo "Invalid PAT file: File is an update pack which contains no OS image." && exit 62 fi -echo "Install: Extracting downloaded system image..." +echo "Install: Extracting downloaded image..." if { tar tf "$PAT"; } >/dev/null 2>&1; then tar xpf $PAT -C $TMP/. @@ -94,7 +100,8 @@ unzip -q -o "$BOOT".zip -d $TMP echo "Install: Creating partition table..." SYSTEM="$TMP/sys.img" -truncate -s 4954537983 "${SYSTEM}" +SYSTEM_SIZE="4954537983" +truncate -s "${SYSTEM_SIZE}" "${SYSTEM}" PART="$TMP/partition.fdisk"