Loading src/config.sh +2 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ RAM_OPTS=$(echo "-m ${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-cpu $CPU_FLAGS -smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1" MAC_OPTS="-machine type=q35,smm=off,usb=off,vmport=off,dump-guest-core=off,hpet=off${KVM_OPTS}" DEV_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4" DEV_OPTS="$DEV_OPTS -object rng-random,id=objrng0,filename=/dev/urandom" DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" DEV_OPTS+=" -object rng-random,id=objrng0,filename=/dev/urandom" DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $DISPLAY_OPTS $MON_OPTS $SERIAL_OPTS $NET_OPTS $DISK_OPTS $DEV_OPTS $ARGUMENTS" ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') Loading src/disk.sh +27 −16 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ supportsDirect() { } createDisk() { local DISK_FILE=$1 local DISK_SPACE=$2 local DISK_DESC=$3 Loading Loading @@ -152,8 +153,8 @@ createDisk() { qcow2) local DISK_PARAM="$DISK_ALLOC" isCow "$FS" && DISK_PARAM="$DISK_PARAM,nocow=on" [ -n "$DISK_FLAGS" ] && DISK_PARAM="$DISK_PARAM,$DISK_FLAGS" isCow "$FS" && DISK_PARAM+=",nocow=on" [ -n "$DISK_FLAGS" ] && DISK_PARAM+=",$DISK_FLAGS" if ! qemu-img create -f "$DISK_FMT" -o "$DISK_PARAM" -- "$DISK_FILE" "$DATA_SIZE" ; then rm -f "$DISK_FILE" Loading @@ -173,6 +174,7 @@ createDisk() { } resizeDisk() { local DISK_FILE=$1 local DISK_SPACE=$2 local DISK_DESC=$3 Loading Loading @@ -238,6 +240,7 @@ resizeDisk() { } convertDisk() { local SOURCE_FILE=$1 local SOURCE_FMT=$2 local DST_FILE=$3 Loading Loading @@ -268,18 +271,19 @@ convertDisk() { fi fi html "Converting $DISK_DESC to $DST_FMT..." info "Converting $DISK_DESC to $DST_FMT, please wait until completed..." local msg="Converting $DISK_DESC to $DST_FMT" html "$msg..." info "$msg, please wait until completed..." local CONV_FLAGS="-p" local DISK_PARAM="$DISK_ALLOC" isCow "$FS" && DISK_PARAM="$DISK_PARAM,nocow=on" isCow "$FS" && DISK_PARAM+=",nocow=on" if [[ "$DST_FMT" != "raw" ]]; then if [[ "$ALLOCATE" == [Nn]* ]]; then CONV_FLAGS="$CONV_FLAGS -c" CONV_FLAGS+=" -c" fi [ -n "$DISK_FLAGS" ] && DISK_PARAM="$DISK_PARAM,$DISK_FLAGS" [ -n "$DISK_FLAGS" ] && DISK_PARAM+=",$DISK_FLAGS" fi # shellcheck disable=SC2086 Loading Loading @@ -308,13 +312,15 @@ convertDisk() { fi fi html "Conversion of $DISK_DESC completed..." info "Conversion of $DISK_DESC to $DST_FMT completed succesfully!" msg="Conversion of $DISK_DESC" html "$msg completed..." info "$msg to $DST_FMT completed succesfully!" return 0 } checkFS () { local FS=$1 local DISK_FILE=$2 local DISK_DESC=$3 Loading Loading @@ -348,6 +354,7 @@ checkFS () { } createDevice () { local DISK_FILE=$1 local DISK_TYPE=$2 local DISK_INDEX=$3 Loading @@ -366,22 +373,22 @@ createDevice () { echo "$result" ;; "usb" ) result="$result,if=none \ result+=",if=none \ -device usb-storage,drive=${DISK_ID}${index}" echo "$result" ;; "ide" ) result="$result,if=none \ result+=",if=none \ -device ide-hd,drive=${DISK_ID},bus=ide.$DISK_INDEX,rotation_rate=$DISK_ROTATION${index}" echo "$result" ;; "blk" | "virtio-blk" ) result="$result,if=none \ result+=",if=none \ -device virtio-blk-pci,drive=${DISK_ID},scsi=off,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}" echo "$result" ;; "scsi" | "virtio-scsi" ) result="$result,if=none \ result+=",if=none \ -device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \ -device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}" echo "$result" Loading @@ -392,6 +399,7 @@ createDevice () { } addDisk () { local DISK_BASE=$1 local DISK_TYPE=$2 local DISK_DESC=$3 Loading Loading @@ -436,6 +444,7 @@ addDisk () { else PREV_FMT="qcow2" fi PREV_EXT=$(fmt2ext "$PREV_FMT") if [ -s "$DISK_BASE.$PREV_EXT" ] ; then Loading @@ -458,12 +467,13 @@ addDisk () { fi OPTS=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE") DISK_OPTS="$DISK_OPTS $OPTS" DISK_OPTS+=" $OPTS" return 0 } addDevice () { local DISK_DEV=$1 local DISK_TYPE=$2 local DISK_INDEX=$3 Loading @@ -474,7 +484,7 @@ addDevice () { local OPTS OPTS=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE") DISK_OPTS="$DISK_OPTS $OPTS" DISK_OPTS+=" $OPTS" return 0 } Loading Loading @@ -585,7 +595,8 @@ else addDisk "$DISK4_FILE" "$DISK_TYPE" "disk4" "$DISK4_SIZE" "6" "0xf" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE" || exit $? fi DISK_OPTS="$DISK_OPTS -object iothread,id=io2" DISK_OPTS+=" -object iothread,id=io2" html "Initialized disks successfully..." return 0 src/display.sh +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then fi DISPLAY_OPTS="-display egl-headless,rendernode=/dev/dri/renderD128" DISPLAY_OPTS="$DISPLAY_OPTS -vga $VGA" DISPLAY_OPTS+=" -vga $VGA" [ ! -d /dev/dri ] && mkdir -m 755 /dev/dri Loading src/install.sh +16 −10 Original line number Diff line number Diff line Loading @@ -146,12 +146,13 @@ if [ ! -s "$RDC" ]; then 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 ERR="Failed to download $LOC" (( rc == 4 )) && error "$ERR , network failure!" && exit 60 (( rc == 8 )) && error "$ERR , server issued an error response!" && exit 60 if (( rc != 0 )); then if (( rc != 22 )) && (( rc != 56 )); then error "Failed to download $LOC, reason: $rc" && exit 60 error "$ERR , reason: $rc" && exit 60 fi SUM="skip" else Loading @@ -171,9 +172,11 @@ if [ ! -s "$RDC" ]; then { 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 ERR="Failed to download $LOC" (( rc == 4 )) && error "$ERR , network failure!" && exit 60 (( rc == 8 )) && error "$ERR , server issued an error response!" && exit 60 (( rc != 0 )) && error "$ERR , reason: $rc" && exit 60 tar --extract --file="$PAT" --directory="$(dirname "$RD")"/. "$(basename "$RD")" rm "$PAT" Loading Loading @@ -226,6 +229,8 @@ rm -rf "$TMP" && mkdir -p "$TMP" info "Install: Downloading $BASE.pat..." MSG="Downloading DSM" ERR="Failed to download $URL" html "$MSG..." PAT="/$BASE.pat" Loading @@ -246,13 +251,14 @@ else { 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 (( rc == 4 )) && error "$ERR , network failure!" && exit 69 (( rc == 8 )) && error "$ERR , server issued an error response!" && exit 69 (( rc != 0 )) && error "$ERR , reason: $rc" && exit 69 fi [ ! -s "$PAT" ] && error "Failed to download $URL" && exit 69 [ ! -s "$PAT" ] && error "$ERR" && exit 69 SIZE=$(stat -c%s "$PAT") Loading src/network.sh +5 −8 Original line number Diff line number Diff line Loading @@ -81,26 +81,23 @@ configureDHCP() { configureDNS() { # dnsmasq configuration: DNSMASQ_OPTS="$DNSMASQ_OPTS --dhcp-range=$VM_NET_IP,$VM_NET_IP --dhcp-host=$VM_NET_MAC,,$VM_NET_IP,$VM_NET_HOST,infinite --dhcp-option=option:netmask,255.255.255.0" DNSMASQ_OPTS+=" --dhcp-range=$VM_NET_IP,$VM_NET_IP --dhcp-host=$VM_NET_MAC,,$VM_NET_IP,$VM_NET_HOST,infinite --dhcp-option=option:netmask,255.255.255.0" # Create lease file for faster resolve echo "0 $VM_NET_MAC $VM_NET_IP $VM_NET_HOST 01:$VM_NET_MAC" > /var/lib/misc/dnsmasq.leases chmod 644 /var/lib/misc/dnsmasq.leases # Set DNS server and gateway DNSMASQ_OPTS="$DNSMASQ_OPTS --dhcp-option=option:dns-server,${VM_NET_IP%.*}.1 --dhcp-option=option:router,${VM_NET_IP%.*}.1" DNSMASQ_OPTS+=" --dhcp-option=option:dns-server,${VM_NET_IP%.*}.1 --dhcp-option=option:router,${VM_NET_IP%.*}.1" # Add DNS entry for container DNSMASQ_OPTS="$DNSMASQ_OPTS --address=/host.lan/${VM_NET_IP%.*}.1" DNSMASQ_OPTS+=" --address=/host.lan/${VM_NET_IP%.*}.1" DNSMASQ_OPTS=$(echo "$DNSMASQ_OPTS" | sed 's/\t/ /g' | tr -s ' ' | sed 's/^ *//') [[ "$DEBUG" == [Yy1]* ]] && set -x if ! $DNSMASQ ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS}; then error "Failed to start dnsmasq, reason: $?" && exit 29 fi { set +x; } 2>/dev/null [[ "$DEBUG" == [Yy1]* ]] && echo return 0 } Loading Loading @@ -195,7 +192,7 @@ configureNAT() { if [ -c /dev/vhost-net ]; then { exec 40>>/dev/vhost-net; rc=$?; } 2>/dev/null || : (( rc == 0 )) && NET_OPTS="$NET_OPTS,vhost=on,vhostfd=40" (( rc == 0 )) && NET_OPTS+=",vhost=on,vhostfd=40" fi configureDNS Loading Loading @@ -354,6 +351,6 @@ else fi NET_OPTS="$NET_OPTS -device virtio-net-pci,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,id=net0" NET_OPTS+=" -device virtio-net-pci,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,id=net0" return 0 Loading
src/config.sh +2 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ RAM_OPTS=$(echo "-m ${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') CPU_OPTS="-cpu $CPU_FLAGS -smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1" MAC_OPTS="-machine type=q35,smm=off,usb=off,vmport=off,dump-guest-core=off,hpet=off${KVM_OPTS}" DEV_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4" DEV_OPTS="$DEV_OPTS -object rng-random,id=objrng0,filename=/dev/urandom" DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" DEV_OPTS+=" -object rng-random,id=objrng0,filename=/dev/urandom" DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $DISPLAY_OPTS $MON_OPTS $SERIAL_OPTS $NET_OPTS $DISK_OPTS $DEV_OPTS $ARGUMENTS" ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') Loading
src/disk.sh +27 −16 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ supportsDirect() { } createDisk() { local DISK_FILE=$1 local DISK_SPACE=$2 local DISK_DESC=$3 Loading Loading @@ -152,8 +153,8 @@ createDisk() { qcow2) local DISK_PARAM="$DISK_ALLOC" isCow "$FS" && DISK_PARAM="$DISK_PARAM,nocow=on" [ -n "$DISK_FLAGS" ] && DISK_PARAM="$DISK_PARAM,$DISK_FLAGS" isCow "$FS" && DISK_PARAM+=",nocow=on" [ -n "$DISK_FLAGS" ] && DISK_PARAM+=",$DISK_FLAGS" if ! qemu-img create -f "$DISK_FMT" -o "$DISK_PARAM" -- "$DISK_FILE" "$DATA_SIZE" ; then rm -f "$DISK_FILE" Loading @@ -173,6 +174,7 @@ createDisk() { } resizeDisk() { local DISK_FILE=$1 local DISK_SPACE=$2 local DISK_DESC=$3 Loading Loading @@ -238,6 +240,7 @@ resizeDisk() { } convertDisk() { local SOURCE_FILE=$1 local SOURCE_FMT=$2 local DST_FILE=$3 Loading Loading @@ -268,18 +271,19 @@ convertDisk() { fi fi html "Converting $DISK_DESC to $DST_FMT..." info "Converting $DISK_DESC to $DST_FMT, please wait until completed..." local msg="Converting $DISK_DESC to $DST_FMT" html "$msg..." info "$msg, please wait until completed..." local CONV_FLAGS="-p" local DISK_PARAM="$DISK_ALLOC" isCow "$FS" && DISK_PARAM="$DISK_PARAM,nocow=on" isCow "$FS" && DISK_PARAM+=",nocow=on" if [[ "$DST_FMT" != "raw" ]]; then if [[ "$ALLOCATE" == [Nn]* ]]; then CONV_FLAGS="$CONV_FLAGS -c" CONV_FLAGS+=" -c" fi [ -n "$DISK_FLAGS" ] && DISK_PARAM="$DISK_PARAM,$DISK_FLAGS" [ -n "$DISK_FLAGS" ] && DISK_PARAM+=",$DISK_FLAGS" fi # shellcheck disable=SC2086 Loading Loading @@ -308,13 +312,15 @@ convertDisk() { fi fi html "Conversion of $DISK_DESC completed..." info "Conversion of $DISK_DESC to $DST_FMT completed succesfully!" msg="Conversion of $DISK_DESC" html "$msg completed..." info "$msg to $DST_FMT completed succesfully!" return 0 } checkFS () { local FS=$1 local DISK_FILE=$2 local DISK_DESC=$3 Loading Loading @@ -348,6 +354,7 @@ checkFS () { } createDevice () { local DISK_FILE=$1 local DISK_TYPE=$2 local DISK_INDEX=$3 Loading @@ -366,22 +373,22 @@ createDevice () { echo "$result" ;; "usb" ) result="$result,if=none \ result+=",if=none \ -device usb-storage,drive=${DISK_ID}${index}" echo "$result" ;; "ide" ) result="$result,if=none \ result+=",if=none \ -device ide-hd,drive=${DISK_ID},bus=ide.$DISK_INDEX,rotation_rate=$DISK_ROTATION${index}" echo "$result" ;; "blk" | "virtio-blk" ) result="$result,if=none \ result+=",if=none \ -device virtio-blk-pci,drive=${DISK_ID},scsi=off,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}" echo "$result" ;; "scsi" | "virtio-scsi" ) result="$result,if=none \ result+=",if=none \ -device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \ -device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}" echo "$result" Loading @@ -392,6 +399,7 @@ createDevice () { } addDisk () { local DISK_BASE=$1 local DISK_TYPE=$2 local DISK_DESC=$3 Loading Loading @@ -436,6 +444,7 @@ addDisk () { else PREV_FMT="qcow2" fi PREV_EXT=$(fmt2ext "$PREV_FMT") if [ -s "$DISK_BASE.$PREV_EXT" ] ; then Loading @@ -458,12 +467,13 @@ addDisk () { fi OPTS=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE") DISK_OPTS="$DISK_OPTS $OPTS" DISK_OPTS+=" $OPTS" return 0 } addDevice () { local DISK_DEV=$1 local DISK_TYPE=$2 local DISK_INDEX=$3 Loading @@ -474,7 +484,7 @@ addDevice () { local OPTS OPTS=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE") DISK_OPTS="$DISK_OPTS $OPTS" DISK_OPTS+=" $OPTS" return 0 } Loading Loading @@ -585,7 +595,8 @@ else addDisk "$DISK4_FILE" "$DISK_TYPE" "disk4" "$DISK4_SIZE" "6" "0xf" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE" || exit $? fi DISK_OPTS="$DISK_OPTS -object iothread,id=io2" DISK_OPTS+=" -object iothread,id=io2" html "Initialized disks successfully..." return 0
src/display.sh +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then fi DISPLAY_OPTS="-display egl-headless,rendernode=/dev/dri/renderD128" DISPLAY_OPTS="$DISPLAY_OPTS -vga $VGA" DISPLAY_OPTS+=" -vga $VGA" [ ! -d /dev/dri ] && mkdir -m 755 /dev/dri Loading
src/install.sh +16 −10 Original line number Diff line number Diff line Loading @@ -146,12 +146,13 @@ if [ ! -s "$RDC" ]; then 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 ERR="Failed to download $LOC" (( rc == 4 )) && error "$ERR , network failure!" && exit 60 (( rc == 8 )) && error "$ERR , server issued an error response!" && exit 60 if (( rc != 0 )); then if (( rc != 22 )) && (( rc != 56 )); then error "Failed to download $LOC, reason: $rc" && exit 60 error "$ERR , reason: $rc" && exit 60 fi SUM="skip" else Loading @@ -171,9 +172,11 @@ if [ ! -s "$RDC" ]; then { 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 ERR="Failed to download $LOC" (( rc == 4 )) && error "$ERR , network failure!" && exit 60 (( rc == 8 )) && error "$ERR , server issued an error response!" && exit 60 (( rc != 0 )) && error "$ERR , reason: $rc" && exit 60 tar --extract --file="$PAT" --directory="$(dirname "$RD")"/. "$(basename "$RD")" rm "$PAT" Loading Loading @@ -226,6 +229,8 @@ rm -rf "$TMP" && mkdir -p "$TMP" info "Install: Downloading $BASE.pat..." MSG="Downloading DSM" ERR="Failed to download $URL" html "$MSG..." PAT="/$BASE.pat" Loading @@ -246,13 +251,14 @@ else { 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 (( rc == 4 )) && error "$ERR , network failure!" && exit 69 (( rc == 8 )) && error "$ERR , server issued an error response!" && exit 69 (( rc != 0 )) && error "$ERR , reason: $rc" && exit 69 fi [ ! -s "$PAT" ] && error "Failed to download $URL" && exit 69 [ ! -s "$PAT" ] && error "$ERR" && exit 69 SIZE=$(stat -c%s "$PAT") Loading
src/network.sh +5 −8 Original line number Diff line number Diff line Loading @@ -81,26 +81,23 @@ configureDHCP() { configureDNS() { # dnsmasq configuration: DNSMASQ_OPTS="$DNSMASQ_OPTS --dhcp-range=$VM_NET_IP,$VM_NET_IP --dhcp-host=$VM_NET_MAC,,$VM_NET_IP,$VM_NET_HOST,infinite --dhcp-option=option:netmask,255.255.255.0" DNSMASQ_OPTS+=" --dhcp-range=$VM_NET_IP,$VM_NET_IP --dhcp-host=$VM_NET_MAC,,$VM_NET_IP,$VM_NET_HOST,infinite --dhcp-option=option:netmask,255.255.255.0" # Create lease file for faster resolve echo "0 $VM_NET_MAC $VM_NET_IP $VM_NET_HOST 01:$VM_NET_MAC" > /var/lib/misc/dnsmasq.leases chmod 644 /var/lib/misc/dnsmasq.leases # Set DNS server and gateway DNSMASQ_OPTS="$DNSMASQ_OPTS --dhcp-option=option:dns-server,${VM_NET_IP%.*}.1 --dhcp-option=option:router,${VM_NET_IP%.*}.1" DNSMASQ_OPTS+=" --dhcp-option=option:dns-server,${VM_NET_IP%.*}.1 --dhcp-option=option:router,${VM_NET_IP%.*}.1" # Add DNS entry for container DNSMASQ_OPTS="$DNSMASQ_OPTS --address=/host.lan/${VM_NET_IP%.*}.1" DNSMASQ_OPTS+=" --address=/host.lan/${VM_NET_IP%.*}.1" DNSMASQ_OPTS=$(echo "$DNSMASQ_OPTS" | sed 's/\t/ /g' | tr -s ' ' | sed 's/^ *//') [[ "$DEBUG" == [Yy1]* ]] && set -x if ! $DNSMASQ ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS}; then error "Failed to start dnsmasq, reason: $?" && exit 29 fi { set +x; } 2>/dev/null [[ "$DEBUG" == [Yy1]* ]] && echo return 0 } Loading Loading @@ -195,7 +192,7 @@ configureNAT() { if [ -c /dev/vhost-net ]; then { exec 40>>/dev/vhost-net; rc=$?; } 2>/dev/null || : (( rc == 0 )) && NET_OPTS="$NET_OPTS,vhost=on,vhostfd=40" (( rc == 0 )) && NET_OPTS+=",vhost=on,vhostfd=40" fi configureDNS Loading Loading @@ -354,6 +351,6 @@ else fi NET_OPTS="$NET_OPTS -device virtio-net-pci,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,id=net0" NET_OPTS+=" -device virtio-net-pci,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,id=net0" return 0