Unverified Commit 0c7acd6e authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: Remove non-printable characters (#949)

parent ad261293
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ set -Eeuo pipefail

if [ -f "$STORAGE/dsm.ver" ]; then
  BASE=$(<"$STORAGE/dsm.ver")
  BASE="${BASE//[![:print:]]/}"
  [ -z "$BASE" ] && BASE="DSM_VirtualDSM_69057"
else
  # Fallback for old installs
+1 −0
Original line number Diff line number Diff line
@@ -399,6 +399,7 @@ getInfo() {
  if [ -z "$VM_NET_MAC" ]; then
    local file="$STORAGE/dsm.mac"
    [ -s "$file" ] && VM_NET_MAC=$(<"$file")
    VM_NET_MAC="${VM_NET_MAC//[![:print:]]/}"
    if [ -z "$VM_NET_MAC" ]; then
      # Generate MAC address based on Docker container ID in hostname
      VM_NET_MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:11:32:\3:\4:\5/')
+4 −3
Original line number Diff line number Diff line
@@ -10,19 +10,20 @@ set -Eeuo pipefail
: "${DEF_MODEL:="qemu64"}"

CLOCKSOURCE="tsc"
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"

if [ ! -f "$CLOCK" ]; then
  warn "file \"$CLOCK\" cannot not found?"
else
  result=$(<"$CLOCK")
  result="${result//[![:print:]]/}"
  case "${result,,}" in
    "${CLOCKSOURCE,,}" ) ;;
    "kvm-clock" ) info "Nested KVM virtualization detected.." ;;
    "hyperv_clocksource_tsc_page" ) info "Nested Hyper-V virtualization detected.." ;;
    "hpet" ) warn "unsupported clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'" ;;
    *) warn "unexpected clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'" ;;
    "hpet" ) warn "unsupported clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'." ;;
    *) warn "unexpected clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'." ;;
  esac
fi