diff --git a/Dockerfile b/Dockerfile index 67949a5..91c86ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM qemux/qemu-host:2.04 as builder +FROM qemux/qemu-host:2.05 as builder # FROM golang as builder # WORKDIR / diff --git a/src/install.sh b/src/install.sh index ac74517..be2180e 100644 --- a/src/install.sh +++ b/src/install.sh @@ -132,9 +132,8 @@ if [ ! -s "$RDC" ]; then rm -f "$RD" rm -f "$RDC" - MSG="Downloading installer..." - PRG="Downloading installer ([P])..." - info "Install: $MSG" && html "$MSG" + MSG="Downloading installer" + info "Install: $MSG..." && html "$MSG..." SIZE=5394188 POS="65627648-71021835" @@ -142,12 +141,13 @@ if [ ! -s "$RDC" ]; then LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" [[ "${URL,,}" == *"_42218.pat" ]] && LOC="$URL" - /run/progress.sh "$RD" "$SIZE" "$PRG" & + /run/progress.sh "$RD" "$SIZE" "$MSG ([P])..." & { curl -r "$POS" -sfk --connect-timeout 10 -S -o "$RD" "$LOC"; rc=$?; } || : fKill "progress.sh" (( rc == 4 )) && error "Failed to download $LOC , network failure!" && exit 60 + (( rc == 8 )) && error "Failed to download $LOC , server issued an error response!" && exit 60 if (( rc != 0 )); then if (( rc != 22 )) && (( rc != 56 )); then @@ -166,12 +166,13 @@ if [ ! -s "$RDC" ]; then rm -f "$RD" rm -f "$PAT" - html "$MSG" - /run/progress.sh "$PAT" "$SIZE" "$PRG" & + html "$MSG..." + /run/progress.sh "$PAT" "$SIZE" "$MSG ([P])..." & { wget "$LOC" -O "$PAT" -q --no-check-certificate --timeout=10 --show-progress "$PROGRESS"; rc=$?; } || : fKill "progress.sh" (( rc == 4 )) && error "Failed to download $LOC , network failure!" && exit 60 + (( rc == 8 )) && error "Failed to download $LOC , server issued an error response!" && exit 60 (( rc != 0 )) && error "Failed to download $LOC , reason: $rc" && exit 60 tar --extract --file="$PAT" --directory="$(dirname "$RD")"/. "$(basename "$RD")" @@ -224,9 +225,8 @@ rm -rf "$TMP" && mkdir -p "$TMP" info "Install: Downloading $BASE.pat..." -MSG="Downloading DSM..." -PRG="Downloading DSM ([P])..." -html "$MSG" +MSG="Downloading DSM" +html "$MSG..." PAT="/$BASE.pat" rm -f "$PAT" @@ -241,12 +241,13 @@ else [[ "${URL,,}" == *"_69057.pat" ]] && SIZE=363837333 [[ "${URL,,}" == *"_42218.pat" ]] && SIZE=379637760 - /run/progress.sh "$PAT" "$SIZE" "$PRG" & + /run/progress.sh "$PAT" "$SIZE" "$MSG ([P])..." & { wget "$URL" -O "$PAT" -q --no-check-certificate --timeout=10 --show-progress "$PROGRESS"; rc=$?; } || : fKill "progress.sh" (( rc == 4 )) && error "Failed to download $URL , network failure!" && exit 69 + (( rc == 8 )) && error "Failed to download $URL , server issued an error response!" && exit 69 (( rc != 0 )) && error "Failed to download $URL , reason: $rc" && exit 69 fi diff --git a/src/proc.sh b/src/proc.sh index 37e3d6e..404aa24 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -50,7 +50,7 @@ fi if [[ "$KVM" != [Nn]* ]]; then - CPU_FEATURES="kvm=on,l3-cache=on" + CPU_FEATURES="kvm=on,l3-cache=on,+hypervisor" KVM_OPTS=",accel=kvm -enable-kvm -global kvm-pit.lost_tick_policy=discard" if ! grep -qw "sse4_2" <<< "$flags"; then @@ -64,10 +64,30 @@ if [[ "$KVM" != [Nn]* ]]; then CPU_FEATURES="$CPU_FEATURES,migratable=no" fi + if grep -qw "svm" <<< "$flags"; then + + # AMD processor + + if grep -qw "tsc_scale" <<< "$flags"; then + CPU_FEATURES="$CPU_FEATURES,+invtsc" + fi + + else + + # Intel processor + + vmx=$(sed -ne '/^vmx flags/s/^.*: //p' /proc/cpuinfo) + + if grep -qw "tsc_scaling" <<< "$vmx"; then + CPU_FEATURES="$CPU_FEATURES,+invtsc" + fi + + fi + else KVM_OPTS="" - CPU_FEATURES="l3-cache=on" + CPU_FEATURES="l3-cache=on,+hypervisor" if [[ "$ARCH" == "amd64" ]]; then KVM_OPTS=" -accel tcg,thread=multi"