diff --git a/run.sh b/run.sh index 265e743..15485e4 100755 --- a/run.sh +++ b/run.sh @@ -18,11 +18,11 @@ if [ ! -f "$IMG/system.img" ]; then echo "Downloading Synology DSM from $URL..." TMP="$IMG/tmp" + FILE="$TMP/dsm.pat" + rm -rf $TMP mkdir -p $TMP - FILE="$TMP/dsm.pat" - rm -rf $FILE wget $URL -O $FILE -q --show-progress echo "Extracting DSM boot image..." @@ -156,8 +156,6 @@ touch /var/lib/misc/udhcpd.leases # Finally, start our DHCPD server udhcpd -I $DUMMY_DHCPD_IP -f $DHCPD_CONF_FILE 2>&1 & -echo "Launching Synology Serial Emulator..." - # Start the Serial Emulator HOST_SERIAL=$(/run/serial.sh) @@ -208,7 +206,7 @@ _graceful_shutdown() { trap _graceful_shutdown SIGINT SIGTERM SIGHUP # And run the VM! A brief explaination of the options here: -# -enable-kvm: Use KVM for this VM (much faster for our case). +# -accel=kvm: use KVM for this VM (much faster for our case). # -nographic: disable SDL graphics. # -serial mon:stdio: use "monitored stdio" as our serial output. exec qemu-system-x86_64 -name Synology -m $RAM_SIZE -machine accel=kvm -cpu host -nographic -serial mon:stdio \ diff --git a/serial.sh b/serial.sh index 84de112..1802efd 100644 --- a/serial.sh +++ b/serial.sh @@ -1,37 +1,7 @@ #!/bin/bash -function random() { - - printf "%06d" $(($RANDOM % 30000 + 1)) -} - -function randomhex() { - - val=$(($RANDOM % 255 + 1)) - echo "obase=16; $val" | bc -} - -function generateRandomLetter() { - - for i in a b c d e f g h j k l m n p q r s t v w x y z; do - echo $i - done | sort -R | tail -1 -} - -function generateRandomValue() { - - for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f g h j k l m n p q r s t v w x y z; do - echo $i - done | sort -R | tail -1 -} - -function toupper() { - - echo $1 | tr '[:lower:]' '[:upper:]' -} - permanent="PSN" serialstart="1960" -serialnum="$(echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1)$permanent"$(random) +serialnum="$(echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1)$permanent"$(printf "%06d" $(($RANDOM % 30000 + 1))) echo $serialnum