Download extractor

This commit is contained in:
Kroese 2023-04-02 08:28:31 +02:00
parent 653108e4a7
commit 570fb981eb
3 changed files with 26 additions and 7 deletions

View File

@ -10,6 +10,8 @@ FROM debian:bookworm-20230320-slim
RUN apt-get update && apt-get -y upgrade && \
apt-get --no-install-recommends -y install \
jq \
curl \
cpio \
wget \
unzip \
procps \
@ -45,10 +47,6 @@ RUN ["chmod", "+x", "/run/qemu-ifup"]
RUN ["chmod", "+x", "/run/qemu-ifdown"]
RUN ["chmod", "+x", "/run/generate-dhcpd-conf"]
COPY extract/lib* /run/extract/
COPY extract/scemd /run/extract/syno_extract_system_patch
RUN ["chmod", "+x", "/run/extract/syno_extract_system_patch"]
COPY disks/template.img.xz /data/
VOLUME /storage

View File

@ -8,9 +8,30 @@ IMG="/storage"
[ ! -f "$IMG/boot.img" ] && rm -f $IMG/system.img
[ -f "$IMG/system.img" ] && exit 0
TMP="$IMG/tmp"
echo "Install: Downloading extractor..."
rm -rf $TMP && mkdir -p $TMP
FILE="$TMP/rd.gz"
curl -r 64493568-69886247 -s -o "$FILE" https://global.synologydownload.com/download/DSM/release/7.0.1/42218/DSM_VirtualDSM_42218.pat
set +e
xz -dc <$TMP/rd.gz >$TMP/rd 2>/dev/null
(cd $TMP && cpio -idm <$TMP/rd 2>/dev/null)
set -e
mkdir -p /run/extract
for file in $TMP/usr/lib/libcurl.so.4 $TMP/usr/lib/libmbedcrypto.so.5 $TMP/usr/lib/libmbedtls.so.13 $TMP/usr/lib/libmbedx509.so.1 $TMP/usr/lib/libmsgpackc.so.2 $TMP/usr/lib/libsodium.so $TMP/usr/lib/libsynocodesign-ng-virtual-junior-wins.so.7 $TMP/usr/syno/bin/scemd; do
cp $file /run/extract/
done
mv /run/extract/scemd /run/extract/syno_extract_system_patch
chmod +x /run/extract/syno_extract_system_patch
echo "Install: Downloading $URL..."
TMP="$IMG/tmp"
FILE="$TMP/dsm.pat"
rm -rf $TMP && mkdir -p $TMP

4
run.sh
View File

@ -16,7 +16,7 @@ FILE="$IMG/boot.img"
FILE="$IMG/system.img"
[ ! -f "$FILE" ] && echo "ERROR: Synology DSM system-image does not exist ($FILE)" && exit 82
FILE="$IMG/data.img"
FILE="$IMG/data$DISK_SIZE.img"
if [ ! -f "$FILE" ]; then
truncate -s "$DISK_SIZE" "$FILE"
mkfs.btrfs -q -L data -d single -m single "$FILE" > /dev/null
@ -154,7 +154,7 @@ exec qemu-system-x86_64 -name Synology -m "$RAM_SIZE" -enable-kvm -cpu host -nog
-drive file="$IMG"/system.img,if=none,id=drive-synosys,format=raw,cache=none,aio=native,detect-zeroes=on \
-device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,bootindex=2 \
-device virtio-scsi-pci,id=hw-userdata,bus=pci.0,addr=0xc \
-drive file="$IMG"/data.img,if=none,id=drive-userdata,format=raw,cache=none,aio=native,detect-zeroes=on \
-drive file="$IMG"/data"$DISK_SIZE".img,if=none,id=drive-userdata,format=raw,cache=none,aio=native,detect-zeroes=on \
-device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,bootindex=3 &
wait $!