Loading src/check.sh +6 −6 Original line number Diff line number Diff line Loading @@ -19,28 +19,28 @@ if [ ! -f "$file" ]; then if [[ "$result" != "success" ]] ; then { msg=$(echo "$json" | jq -r '.message'); rc=$?; } || : echo "Guest replied ${result}: $msg" && exit 1 echo "Guest replied $result: $msg" && exit 1 fi { port=$(echo "$json" | jq -r '.data.data.dsm_setting.data.http_port'); rc=$?; } || : (( rc != 0 )) && echo "Failed to parse response from guest: jq error $rc ( $json )" && exit 1 [[ "$port" == "null" ]] && echo "Guest has not set a portnumber yet.." && exit 1 [ -z "${port}" ] && echo "Guest has not set a portnumber yet.." && exit 1 [ -z "$port" ] && echo "Guest has not set a portnumber yet.." && exit 1 { ip=$(echo "$json" | jq -r '.data.data.ip.data[] | select((.name=="eth0") and has("ip")).ip'); rc=$?; } || : (( rc != 0 )) && echo "Failed to parse response from guest: jq error $rc ( $json )" && exit 1 [[ "$ip" == "null" ]] && echo "Guest returned invalid response: $json" && exit 1 [ -z "${ip}" ] && echo "Guest has not received an IP yet.." && exit 1 [ -z "$ip" ] && echo "Guest has not received an IP yet.." && exit 1 echo "${ip}:${port}" > $file echo "$ip:$port" > $file fi location=$(cat "$file") if ! curl -m 20 -ILfSs "http://${location}/" > /dev/null; then if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then rm -f $file echo "Failed to reach http://${location}" echo "Failed to reach http://$location" exit 1 fi Loading src/config.sh +8 −8 Original line number Diff line number Diff line Loading @@ -12,29 +12,29 @@ else [ -e /dev/kvm ] && KVM_ERR="(no write access)" || KVM_ERR="(device file missing)" fi if [ -n "${KVM_ERR}" ]; then if [ -n "$KVM_ERR" ]; then if [ "$ARCH" == "amd64" ]; then error "KVM acceleration not detected ${KVM_ERR}, see the FAQ about this." [[ "${DEBUG}" != [Yy1]* ]] && exit 88 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 DEF_OPTS="-nographic -nodefaults -boot strict=on -display none" RAM_OPTS=$(echo "-m ${RAM_SIZE}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-smp ${CPU_CORES},sockets=1,dies=1,cores=${CPU_CORES},threads=1" RAM_OPTS=$(echo "-m $RAM_SIZE" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1" MAC_OPTS="-machine type=q35,usb=off,dump-guest-core=off,hpet=off${KVM_OPTS}" EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4" EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom" EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" if [[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then if [[ "$GPU" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128" DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1" DEF_OPTS="$DEF_OPTS -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1" fi ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}" ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $MON_OPTS $SERIAL_OPTS $NET_OPTS $DISK_OPTS $EXTRA_OPTS $ARGUMENTS" ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') return 0 src/disk.sh +31 −31 Original line number Diff line number Diff line Loading @@ -17,11 +17,11 @@ SYSTEM="$STORAGE/$BASE.system.img" DISK_OPTS="\ -device virtio-scsi-pci,id=hw-synoboot,bus=pcie.0,addr=0xa \ -drive file=${BOOT},if=none,id=drive-synoboot,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,rotation_rate=${DISK_ROTATION},bootindex=1 \ -drive file=$BOOT,if=none,id=drive-synoboot,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,rotation_rate=$DISK_ROTATION,bootindex=1 \ -device virtio-scsi-pci,id=hw-synosys,bus=pcie.0,addr=0xb \ -drive file=${SYSTEM},if=none,id=drive-synosys,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,rotation_rate=${DISK_ROTATION},bootindex=2" -drive file=$SYSTEM,if=none,id=drive-synosys,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,rotation_rate=$DISK_ROTATION,bootindex=2" fmt2ext() { local DISK_FMT=$1 Loading Loading @@ -50,7 +50,7 @@ ext2fmt() { echo "raw" ;; *) error "Unrecognized file extension: .${DISK_EXT}" && exit 88 error "Unrecognized file extension: .$DISK_EXT" && exit 88 ;; esac } Loading Loading @@ -92,7 +92,7 @@ resizeDisk() { GB=$(( (CUR_SIZE + 1073741823)/1073741824 )) info "Resizing $DISK_DESC from ${GB}G to $DISK_SPACE .." FAIL="Could not resize $DISK_FMT file of $DISK_DESC (${DISK_FILE}) from ${GB}G to $DISK_SPACE .." FAIL="Could not resize $DISK_FMT file of $DISK_DESC ($DISK_FILE) from ${GB}G to $DISK_SPACE .." REQ=$((DATA_SIZE-CUR_SIZE)) (( REQ < 1 )) && error "Shrinking disks is not supported!" && exit 84 Loading Loading @@ -163,11 +163,11 @@ createDisk() { local DISK_DESC=$3 local DISK_FMT=$4 FAIL="Could not create a $DISK_SPACE $DISK_FMT file for $DISK_DESC (${DISK_FILE})" FAIL="Could not create a $DISK_SPACE $DISK_FMT file for $DISK_DESC ($DISK_FILE)" case "${DISK_FMT,,}" in raw) if [[ "${ALLOCATE}" == [Nn]* ]]; then if [[ "$ALLOCATE" == [Nn]* ]]; then # Create an empty file if ! truncate -s "$DISK_SPACE" "$DISK_FILE"; then Loading Loading @@ -221,7 +221,7 @@ addDisk () { local DISK_ADDRESS=$7 local DISK_FMT=$8 DISK_FILE="${DISK_BASE}.${DISK_EXT}" DISK_FILE="$DISK_BASE.$DISK_EXT" DIR=$(dirname "$DISK_FILE") [ ! -d "$DIR" ] && return 0 Loading Loading @@ -249,15 +249,15 @@ addDisk () { PREV_FMT="qcow2" fi PREV_EXT="$(fmt2ext "$PREV_FMT")" PREV_FILE="${DISK_BASE}.${PREV_EXT}" PREV_FILE="$DISK_BASE.$PREV_EXT" if [ -f "$PREV_FILE" ] ; then info "Detected that ${DISK_DESC^^}_FMT changed from \"${PREV_FMT}\" to \"${DISK_FMT}\"." info "Detected that ${DISK_DESC^^}_FMT changed from \"$PREV_FMT\" to \"$DISK_FMT\"." info "Starting conversion of $DISK_DESC to this new format, please wait until completed..." local TMP_FILE TMP_FILE="${DISK_BASE}.tmp" TMP_FILE="$DISK_BASE.tmp" rm -f "$TMP_FILE" if ! convertDisk "$PREV_FILE" "$PREV_FMT" "$TMP_FILE" "$DISK_FMT" ; then Loading Loading @@ -285,44 +285,44 @@ addDisk () { fi DISK_OPTS="${DISK_OPTS} \ -device virtio-scsi-pci,id=hw-${DISK_ID},bus=pcie.0,addr=${DISK_ADDRESS} \ -drive file=${DISK_FILE},if=none,id=drive-${DISK_ID},format=${DISK_FMT},cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-${DISK_ID}.0,channel=0,scsi-id=0,lun=0,drive=drive-${DISK_ID},id=${DISK_ID},rotation_rate=${DISK_ROTATION},bootindex=${DISK_INDEX}" DISK_OPTS="$DISK_OPTS \ -device virtio-scsi-pci,id=hw-$DISK_ID,bus=pcie.0,addr=$DISK_ADDRESS \ -drive file=$DISK_FILE,if=none,id=drive-$DISK_ID,format=$DISK_FMT,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-$DISK_ID.0,channel=0,scsi-id=0,lun=0,drive=drive-$DISK_ID,id=$DISK_ID,rotation_rate=$DISK_ROTATION,bootindex=$DISK_INDEX" return 0 } DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $? DISK1_FILE="${STORAGE}/data" if [[ ! -f "${DISK1_FILE}.img" ]] && [[ -f "${STORAGE}/data${DISK_SIZE}.img" ]]; then DISK1_FILE="$STORAGE/data" if [[ ! -f "$DISK1_FILE.img" ]] && [[ -f "$STORAGE/data${DISK_SIZE}.img" ]]; then # Fallback for legacy installs mv "${STORAGE}/data${DISK_SIZE}.img" "${DISK1_FILE}.img" mv "$STORAGE/data${DISK_SIZE}.img" "$DISK1_FILE.img" fi DISK2_FILE="/storage2/data2" if [ ! -f "${DISK2_FILE}.img" ]; then if [ ! -f "$DISK2_FILE.img" ]; then # Fallback for legacy installs FALLBACK="/storage2/data.img" if [[ -f "${DISK1_FILE}.img" ]] && [[ -f "$FALLBACK" ]]; then if [[ -f "$DISK1_FILE.img" ]] && [[ -f "$FALLBACK" ]]; then SIZE1=$(stat -c%s "$FALLBACK") SIZE2=$(stat -c%s "${DISK1_FILE}.img") SIZE2=$(stat -c%s "$DISK1_FILE.img") if [[ SIZE1 -ne SIZE2 ]]; then mv "$FALLBACK" "${DISK2_FILE}.img" mv "$FALLBACK" "$DISK2_FILE.img" fi fi fi DISK3_FILE="/storage3/data3" if [ ! -f "${DISK3_FILE}.img" ]; then if [ ! -f "$DISK3_FILE.img" ]; then # Fallback for legacy installs FALLBACK="/storage3/data.img" if [[ -f "${DISK1_FILE}.img" ]] && [[ -f "$FALLBACK" ]]; then if [[ -f "$DISK1_FILE.img" ]] && [[ -f "$FALLBACK" ]]; then SIZE1=$(stat -c%s "$FALLBACK") SIZE2=$(stat -c%s "${DISK1_FILE}.img") SIZE2=$(stat -c%s "$DISK1_FILE.img") if [[ SIZE1 -ne SIZE2 ]]; then mv "$FALLBACK" "${DISK3_FILE}.img" mv "$FALLBACK" "$DISK3_FILE.img" fi fi fi Loading Loading @@ -354,10 +354,10 @@ addDevice () { [ -z "$DISK_DEV" ] && return 0 [ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55 DISK_OPTS="${DISK_OPTS} \ -device virtio-scsi-pci,id=hw-${DISK_ID},bus=pcie.0,addr=${DISK_ADDRESS} \ -drive file=${DISK_DEV},if=none,id=drive-${DISK_ID},format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-${DISK_ID}.0,channel=0,scsi-id=0,lun=0,drive=drive-${DISK_ID},id=${DISK_ID},rotation_rate=${DISK_ROTATION},bootindex=${DISK_INDEX}" DISK_OPTS="$DISK_OPTS \ -device virtio-scsi-pci,id=hw-$DISK_ID,bus=pcie.0,addr=$DISK_ADDRESS \ -drive file=$DISK_DEV,if=none,id=drive-$DISK_ID,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-$DISK_ID.0,channel=0,scsi-id=0,lun=0,drive=drive-$DISK_ID,id=$DISK_ID,rotation_rate=$DISK_ROTATION,bootindex=$DISK_INDEX" return 0 } Loading src/entry.sh +5 −5 Original line number Diff line number Diff line Loading @@ -17,17 +17,17 @@ cd /run trap - ERR if [[ "${CONSOLE}" == [Yy]* ]]; then exec qemu-system-x86_64 -pidfile "${QEMU_PID}" ${ARGS:+ $ARGS} if [[ "$CONSOLE" == [Yy]* ]]; then exec qemu-system-x86_64 -pidfile "$QEMU_PID" ${ARGS:+ $ARGS} exit $? fi set -m ( [[ "${DEBUG}" == [Yy1]* ]] && info "$VERS" && set -x qemu-system-x86_64 ${ARGS:+ $ARGS} & echo $! > "${QEMU_PID}" [[ "$DEBUG" == [Yy1]* ]] && info "$VERS" && set -x qemu-system-x86_64 ${ARGS:+ $ARGS} & echo $! > "$QEMU_PID" { set +x; } 2>/dev/null ) set +m tail --pid "$(cat "${QEMU_PID}")" --follow /dev/null & wait $! tail --pid "$(cat "$QEMU_PID")" --follow /dev/null & wait $! src/gpu.sh +1 −1 Original line number Diff line number Diff line #!/bin/bash set -Eeuo pipefail if [[ "${GPU}" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then return 0 fi Loading Loading
src/check.sh +6 −6 Original line number Diff line number Diff line Loading @@ -19,28 +19,28 @@ if [ ! -f "$file" ]; then if [[ "$result" != "success" ]] ; then { msg=$(echo "$json" | jq -r '.message'); rc=$?; } || : echo "Guest replied ${result}: $msg" && exit 1 echo "Guest replied $result: $msg" && exit 1 fi { port=$(echo "$json" | jq -r '.data.data.dsm_setting.data.http_port'); rc=$?; } || : (( rc != 0 )) && echo "Failed to parse response from guest: jq error $rc ( $json )" && exit 1 [[ "$port" == "null" ]] && echo "Guest has not set a portnumber yet.." && exit 1 [ -z "${port}" ] && echo "Guest has not set a portnumber yet.." && exit 1 [ -z "$port" ] && echo "Guest has not set a portnumber yet.." && exit 1 { ip=$(echo "$json" | jq -r '.data.data.ip.data[] | select((.name=="eth0") and has("ip")).ip'); rc=$?; } || : (( rc != 0 )) && echo "Failed to parse response from guest: jq error $rc ( $json )" && exit 1 [[ "$ip" == "null" ]] && echo "Guest returned invalid response: $json" && exit 1 [ -z "${ip}" ] && echo "Guest has not received an IP yet.." && exit 1 [ -z "$ip" ] && echo "Guest has not received an IP yet.." && exit 1 echo "${ip}:${port}" > $file echo "$ip:$port" > $file fi location=$(cat "$file") if ! curl -m 20 -ILfSs "http://${location}/" > /dev/null; then if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then rm -f $file echo "Failed to reach http://${location}" echo "Failed to reach http://$location" exit 1 fi Loading
src/config.sh +8 −8 Original line number Diff line number Diff line Loading @@ -12,29 +12,29 @@ else [ -e /dev/kvm ] && KVM_ERR="(no write access)" || KVM_ERR="(device file missing)" fi if [ -n "${KVM_ERR}" ]; then if [ -n "$KVM_ERR" ]; then if [ "$ARCH" == "amd64" ]; then error "KVM acceleration not detected ${KVM_ERR}, see the FAQ about this." [[ "${DEBUG}" != [Yy1]* ]] && exit 88 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 DEF_OPTS="-nographic -nodefaults -boot strict=on -display none" RAM_OPTS=$(echo "-m ${RAM_SIZE}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-smp ${CPU_CORES},sockets=1,dies=1,cores=${CPU_CORES},threads=1" RAM_OPTS=$(echo "-m $RAM_SIZE" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1" MAC_OPTS="-machine type=q35,usb=off,dump-guest-core=off,hpet=off${KVM_OPTS}" EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4" EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom" EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" if [[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then if [[ "$GPU" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128" DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1" DEF_OPTS="$DEF_OPTS -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1" fi ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}" ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $MON_OPTS $SERIAL_OPTS $NET_OPTS $DISK_OPTS $EXTRA_OPTS $ARGUMENTS" ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') return 0
src/disk.sh +31 −31 Original line number Diff line number Diff line Loading @@ -17,11 +17,11 @@ SYSTEM="$STORAGE/$BASE.system.img" DISK_OPTS="\ -device virtio-scsi-pci,id=hw-synoboot,bus=pcie.0,addr=0xa \ -drive file=${BOOT},if=none,id=drive-synoboot,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,rotation_rate=${DISK_ROTATION},bootindex=1 \ -drive file=$BOOT,if=none,id=drive-synoboot,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,rotation_rate=$DISK_ROTATION,bootindex=1 \ -device virtio-scsi-pci,id=hw-synosys,bus=pcie.0,addr=0xb \ -drive file=${SYSTEM},if=none,id=drive-synosys,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,rotation_rate=${DISK_ROTATION},bootindex=2" -drive file=$SYSTEM,if=none,id=drive-synosys,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,rotation_rate=$DISK_ROTATION,bootindex=2" fmt2ext() { local DISK_FMT=$1 Loading Loading @@ -50,7 +50,7 @@ ext2fmt() { echo "raw" ;; *) error "Unrecognized file extension: .${DISK_EXT}" && exit 88 error "Unrecognized file extension: .$DISK_EXT" && exit 88 ;; esac } Loading Loading @@ -92,7 +92,7 @@ resizeDisk() { GB=$(( (CUR_SIZE + 1073741823)/1073741824 )) info "Resizing $DISK_DESC from ${GB}G to $DISK_SPACE .." FAIL="Could not resize $DISK_FMT file of $DISK_DESC (${DISK_FILE}) from ${GB}G to $DISK_SPACE .." FAIL="Could not resize $DISK_FMT file of $DISK_DESC ($DISK_FILE) from ${GB}G to $DISK_SPACE .." REQ=$((DATA_SIZE-CUR_SIZE)) (( REQ < 1 )) && error "Shrinking disks is not supported!" && exit 84 Loading Loading @@ -163,11 +163,11 @@ createDisk() { local DISK_DESC=$3 local DISK_FMT=$4 FAIL="Could not create a $DISK_SPACE $DISK_FMT file for $DISK_DESC (${DISK_FILE})" FAIL="Could not create a $DISK_SPACE $DISK_FMT file for $DISK_DESC ($DISK_FILE)" case "${DISK_FMT,,}" in raw) if [[ "${ALLOCATE}" == [Nn]* ]]; then if [[ "$ALLOCATE" == [Nn]* ]]; then # Create an empty file if ! truncate -s "$DISK_SPACE" "$DISK_FILE"; then Loading Loading @@ -221,7 +221,7 @@ addDisk () { local DISK_ADDRESS=$7 local DISK_FMT=$8 DISK_FILE="${DISK_BASE}.${DISK_EXT}" DISK_FILE="$DISK_BASE.$DISK_EXT" DIR=$(dirname "$DISK_FILE") [ ! -d "$DIR" ] && return 0 Loading Loading @@ -249,15 +249,15 @@ addDisk () { PREV_FMT="qcow2" fi PREV_EXT="$(fmt2ext "$PREV_FMT")" PREV_FILE="${DISK_BASE}.${PREV_EXT}" PREV_FILE="$DISK_BASE.$PREV_EXT" if [ -f "$PREV_FILE" ] ; then info "Detected that ${DISK_DESC^^}_FMT changed from \"${PREV_FMT}\" to \"${DISK_FMT}\"." info "Detected that ${DISK_DESC^^}_FMT changed from \"$PREV_FMT\" to \"$DISK_FMT\"." info "Starting conversion of $DISK_DESC to this new format, please wait until completed..." local TMP_FILE TMP_FILE="${DISK_BASE}.tmp" TMP_FILE="$DISK_BASE.tmp" rm -f "$TMP_FILE" if ! convertDisk "$PREV_FILE" "$PREV_FMT" "$TMP_FILE" "$DISK_FMT" ; then Loading Loading @@ -285,44 +285,44 @@ addDisk () { fi DISK_OPTS="${DISK_OPTS} \ -device virtio-scsi-pci,id=hw-${DISK_ID},bus=pcie.0,addr=${DISK_ADDRESS} \ -drive file=${DISK_FILE},if=none,id=drive-${DISK_ID},format=${DISK_FMT},cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-${DISK_ID}.0,channel=0,scsi-id=0,lun=0,drive=drive-${DISK_ID},id=${DISK_ID},rotation_rate=${DISK_ROTATION},bootindex=${DISK_INDEX}" DISK_OPTS="$DISK_OPTS \ -device virtio-scsi-pci,id=hw-$DISK_ID,bus=pcie.0,addr=$DISK_ADDRESS \ -drive file=$DISK_FILE,if=none,id=drive-$DISK_ID,format=$DISK_FMT,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-$DISK_ID.0,channel=0,scsi-id=0,lun=0,drive=drive-$DISK_ID,id=$DISK_ID,rotation_rate=$DISK_ROTATION,bootindex=$DISK_INDEX" return 0 } DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $? DISK1_FILE="${STORAGE}/data" if [[ ! -f "${DISK1_FILE}.img" ]] && [[ -f "${STORAGE}/data${DISK_SIZE}.img" ]]; then DISK1_FILE="$STORAGE/data" if [[ ! -f "$DISK1_FILE.img" ]] && [[ -f "$STORAGE/data${DISK_SIZE}.img" ]]; then # Fallback for legacy installs mv "${STORAGE}/data${DISK_SIZE}.img" "${DISK1_FILE}.img" mv "$STORAGE/data${DISK_SIZE}.img" "$DISK1_FILE.img" fi DISK2_FILE="/storage2/data2" if [ ! -f "${DISK2_FILE}.img" ]; then if [ ! -f "$DISK2_FILE.img" ]; then # Fallback for legacy installs FALLBACK="/storage2/data.img" if [[ -f "${DISK1_FILE}.img" ]] && [[ -f "$FALLBACK" ]]; then if [[ -f "$DISK1_FILE.img" ]] && [[ -f "$FALLBACK" ]]; then SIZE1=$(stat -c%s "$FALLBACK") SIZE2=$(stat -c%s "${DISK1_FILE}.img") SIZE2=$(stat -c%s "$DISK1_FILE.img") if [[ SIZE1 -ne SIZE2 ]]; then mv "$FALLBACK" "${DISK2_FILE}.img" mv "$FALLBACK" "$DISK2_FILE.img" fi fi fi DISK3_FILE="/storage3/data3" if [ ! -f "${DISK3_FILE}.img" ]; then if [ ! -f "$DISK3_FILE.img" ]; then # Fallback for legacy installs FALLBACK="/storage3/data.img" if [[ -f "${DISK1_FILE}.img" ]] && [[ -f "$FALLBACK" ]]; then if [[ -f "$DISK1_FILE.img" ]] && [[ -f "$FALLBACK" ]]; then SIZE1=$(stat -c%s "$FALLBACK") SIZE2=$(stat -c%s "${DISK1_FILE}.img") SIZE2=$(stat -c%s "$DISK1_FILE.img") if [[ SIZE1 -ne SIZE2 ]]; then mv "$FALLBACK" "${DISK3_FILE}.img" mv "$FALLBACK" "$DISK3_FILE.img" fi fi fi Loading Loading @@ -354,10 +354,10 @@ addDevice () { [ -z "$DISK_DEV" ] && return 0 [ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55 DISK_OPTS="${DISK_OPTS} \ -device virtio-scsi-pci,id=hw-${DISK_ID},bus=pcie.0,addr=${DISK_ADDRESS} \ -drive file=${DISK_DEV},if=none,id=drive-${DISK_ID},format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \ -device scsi-hd,bus=hw-${DISK_ID}.0,channel=0,scsi-id=0,lun=0,drive=drive-${DISK_ID},id=${DISK_ID},rotation_rate=${DISK_ROTATION},bootindex=${DISK_INDEX}" DISK_OPTS="$DISK_OPTS \ -device virtio-scsi-pci,id=hw-$DISK_ID,bus=pcie.0,addr=$DISK_ADDRESS \ -drive file=$DISK_DEV,if=none,id=drive-$DISK_ID,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on \ -device scsi-hd,bus=hw-$DISK_ID.0,channel=0,scsi-id=0,lun=0,drive=drive-$DISK_ID,id=$DISK_ID,rotation_rate=$DISK_ROTATION,bootindex=$DISK_INDEX" return 0 } Loading
src/entry.sh +5 −5 Original line number Diff line number Diff line Loading @@ -17,17 +17,17 @@ cd /run trap - ERR if [[ "${CONSOLE}" == [Yy]* ]]; then exec qemu-system-x86_64 -pidfile "${QEMU_PID}" ${ARGS:+ $ARGS} if [[ "$CONSOLE" == [Yy]* ]]; then exec qemu-system-x86_64 -pidfile "$QEMU_PID" ${ARGS:+ $ARGS} exit $? fi set -m ( [[ "${DEBUG}" == [Yy1]* ]] && info "$VERS" && set -x qemu-system-x86_64 ${ARGS:+ $ARGS} & echo $! > "${QEMU_PID}" [[ "$DEBUG" == [Yy1]* ]] && info "$VERS" && set -x qemu-system-x86_64 ${ARGS:+ $ARGS} & echo $! > "$QEMU_PID" { set +x; } 2>/dev/null ) set +m tail --pid "$(cat "${QEMU_PID}")" --follow /dev/null & wait $! tail --pid "$(cat "$QEMU_PID")" --follow /dev/null & wait $!
src/gpu.sh +1 −1 Original line number Diff line number Diff line #!/bin/bash set -Eeuo pipefail if [[ "${GPU}" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then return 0 fi Loading