feat: Add ARGUMENTS variable
This commit is contained in:
parent
7179a4b0fe
commit
8c775a351d
1 changed files with 4 additions and 2 deletions
|
@ -6,6 +6,7 @@ set -Eeuo pipefail
|
|||
: ${BOOT:=''} # URL of the ISO file
|
||||
: ${DEBUG:='N'} # Enable debug mode
|
||||
: ${ALLOCATE:='Y'} # Preallocate diskspace
|
||||
: ${ARGUMENTS:=''} # Extra QEMU parameters
|
||||
: ${CPU_CORES:='1'} # Amount of CPU cores
|
||||
: ${DISK_SIZE:='16G'} # Initial data disk size
|
||||
: ${RAM_SIZE:='512M'} # Maximum RAM amount
|
||||
|
@ -21,6 +22,7 @@ trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR
|
|||
|
||||
STORAGE="/storage"
|
||||
KERNEL=$(uname -r | cut -b 1)
|
||||
MINOR=$(uname -r | cut -d '.' -f2)
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
VERS=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1)
|
||||
|
||||
|
@ -66,7 +68,7 @@ MAC_OPTS="-machine type=q35,usb=off,dump-guest-core=off,hpet=off${KVM_OPTS}"
|
|||
SERIAL_OPTS="-serial mon:stdio -device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x3"
|
||||
EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0 -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0"
|
||||
|
||||
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS}"
|
||||
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 ' ')
|
||||
|
||||
trap - ERR
|
||||
|
@ -79,7 +81,7 @@ set -m
|
|||
)
|
||||
set +m
|
||||
|
||||
if (( KERNEL > 4 )); then
|
||||
if (( KERNEL > 5 )) || ( (( KERNEL == 5 )) && (( MINOR > 2 )) ); then
|
||||
pidwait -F "${_QEMU_PID}" & wait $!
|
||||
else
|
||||
tail --pid "$(cat "${_QEMU_PID}")" --follow /dev/null & wait $!
|
||||
|
|
Loading…
Reference in a new issue