From 018d2ff11f24a8c0cecbf0c02d8ff13e67c13402 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 24 May 2023 23:13:41 +0200 Subject: [PATCH 1/3] feat: Allow installation on other architectures --- run/install.sh | 61 +++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/run/install.sh b/run/install.sh index 6d6e94bc..6ff1577e 100644 --- a/run/install.sh +++ b/run/install.sh @@ -10,11 +10,12 @@ DL="https://global.synologydownload.com/download/DSM" if [ -z "$URL" ]; then URL="$DL/release/7.2/64561/DSM_VirtualDSM_64561.pat" - #URL="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" #URL="$DL/release/7.1.1/42962-1/DSM_VirtualDSM_42962.pat" fi +[ "$ARCH" != "amd64" ] && URL="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" + # Check if output is to interactive TTY if [ -t 1 ]; then PROGRESS="--progress=bar:noscroll" @@ -36,7 +37,7 @@ rm -rf "$TMP" && mkdir -p "$TMP" [[ "${DEBUG}" == [Yy1]* ]] && set -x -if [ ! -f "${RDC}" ]; then +if [ ! -f "${RDC}" ] && [ "$ARCH" == "amd64" ]; then info "Install: Downloading installer..." @@ -68,28 +69,32 @@ if [ ! -f "${RDC}" ]; then fi -{ xz -dc <"$RDC" >"$TMP/rd" 2>/dev/null; rc=$?; } || : -(( rc != 1 )) && error "Failed to unxz $RDC, reason $rc" && exit 91 +if [ -f "${RDC}" ] && [ "$ARCH" == "amd64" ]; then -{ (cd "$TMP" && cpio -idm <"$TMP/rd" 2>/dev/null); rc=$?; } || : -(( rc != 0 )) && error "Failed to cpio $RDC, reason $rc" && exit 92 + { xz -dc <"$RDC" >"$TMP/rd" 2>/dev/null; rc=$?; } || : + (( rc != 1 )) && error "Failed to unxz $RDC, reason $rc" && exit 91 -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 + { (cd "$TMP" && cpio -idm <"$TMP/rd" 2>/dev/null); rc=$?; } || : + (( rc != 0 )) && error "Failed to cpio $RDC, reason $rc" && exit 92 -mv /run/extract/scemd /run/extract/syno_extract_system_patch -chmod +x /run/extract/syno_extract_system_patch + 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 -rm -rf "$TMP" && mkdir -p "$TMP" + mv /run/extract/scemd /run/extract/syno_extract_system_patch + chmod +x /run/extract/syno_extract_system_patch + + rm -rf "$TMP" && mkdir -p "$TMP" + +fi info "Install: Downloading $(basename "$URL")..." @@ -110,12 +115,18 @@ fi info "Install: Extracting downloaded image..." if { tar tf "$PAT"; } >/dev/null 2>&1; then - tar xpf "$PAT" -C "$TMP/." + + tar xpf "$PAT" -C "$TMP/." + else - export LD_LIBRARY_PATH="/run/extract" - { /run/extract/syno_extract_system_patch "$PAT" "$TMP/."; rc=$?; } || : - (( rc != 0 )) && error "Failed to extract PAT file, reason $rc" && exit 63 - export LD_LIBRARY_PATH="" + + [ "$ARCH" != "amd64" ] && error "Wrong architecture: $ARCH" && exit 65 + + export LD_LIBRARY_PATH="/run/extract" + { /run/extract/syno_extract_system_patch "$PAT" "$TMP/."; rc=$?; } || : + (( rc != 0 )) && error "Failed to extract PAT file, reason $rc" && exit 63 + export LD_LIBRARY_PATH="" + fi HDA="$TMP/hda1" From e0e089a12836c23cbda670b65bb7d3fe3064cab3 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 24 May 2023 23:21:30 +0200 Subject: [PATCH 2/3] fix: Display correct architecture --- run/serial.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/run/serial.sh b/run/serial.sh index 3af2e75f..72c3db02 100644 --- a/run/serial.sh +++ b/run/serial.sh @@ -18,7 +18,11 @@ fi if [ -n "$HOST_CPU" ]; then HOST_CPU="$HOST_CPU,," else - HOST_CPU="QEMU, Virtual CPU, X86_64" + if [ "$ARCH" == "amd64" ]; then + HOST_CPU="QEMU, Virtual CPU, X86_64" + else + HOST_CPU="QEMU, Virtual CPU, $ARCH" + fi fi HOST_ARGS=() From e8e51c6e0333f5e375ad081ac0205ac5fad119eb Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 24 May 2023 23:24:57 +0200 Subject: [PATCH 3/3] fix: Disable KVM on ARM --- run/run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run/run.sh b/run/run.sh index 94ba2e45..7be661de 100755 --- a/run/run.sh +++ b/run/run.sh @@ -62,8 +62,10 @@ else fi if [ -n "${KVM_ERR}" ]; then - error "KVM acceleration not detected ${KVM_ERR}, see the FAQ about this." - [[ "${DEBUG}" != [Yy1]* ]] && exit 88 + if [ "$ARCH" == "amd64" ]; then + error "KVM acceleration not detected ${KVM_ERR}, see the FAQ about this." + [[ "${DEBUG}" != [Yy1]* ]] && exit 88 + fi else KVM_OPTS=",accel=kvm -enable-kvm -cpu host" fi