Package: fai-client Version: 5.8.4 Severity: normal Dear Maintainer,
fai-kvm does not currently allow to pass arguments to the underlying qemu-kvm process which could come in handy on certain scenarios (ie: if you want to setup yubikeys from fai, you need usb passthrough to kvm for testing). I attach two proposed patches (from my limited bash kung-fu): - double dash enables the "standard" syntax: fai-kvm [fai-kvm args] -- [args passed to qemu-kvm] - shift abuse enables the syntax: fai-kvm [fai-kvm args] [args passed to qemu-kvm] They are named based on how they're coded. Double dash is a few lines longer, but the syntax is way more clear on what programs handles which parameters. I personally prefer that one. Hope this can be implemented in future releases of fai! marc -- System Information: Debian Release: 10.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages fai-client depends on: ii debconf-utils 1.5.71 ii file 1:5.35-4 ii iproute2 4.20.0-2 ii libapt-pkg-perl 0.1.34+b1 ii libfile-lchown-perl 0.02-2+b5 ii perl 5.28.1-6 Versions of packages fai-client recommends: ii fdisk 2.33.1-0.1 ii libgraph-perl 1:0.9704-1 ii util-linux 2.33.1-0.1 Versions of packages fai-client suggests: pn logtail <none> -- Configuration Files: /etc/fai/fai.conf [Errno 2] No such file or directory: '/etc/fai/fai.conf' (sorry, I have /etc/fai inside /srv/fai! but I don't think the file is needed for this). -- no debconf information
--- /usr/bin/fai-kvm 2019-03-27 22:44:02.000000000 +0100 +++ ./fai-kvm 2019-05-28 16:18:20.466019544 +0200 @@ -24,26 +24,28 @@ # boot from disk [ -n "$1" ] && disk=$1 + shift case "$disk" in *.raw) f=",format=raw" ;; esac set -x - kvm $gopt -boot order=c $net -drive file=$disk,if=virtio$f + kvm $gopt -boot order=c $net -drive file=$disk,if=virtio$f $* } # - - - - - - - - - - - - - - - - - - - - - - - - - boot_pxe() { # PXE boot set -x - kvm $gopt -boot order=nc $net $disk + kvm $gopt -boot order=nc $net $disk $* } # - - - - - - - - - - - - - - - - - - - - - - - - - boot_cd() { [ -n "$1" ] && cdimage=$1 + shift # boot fai-cd set -x - kvm $gopt -boot order=cd $net $disk -cdrom $cdimage + kvm $gopt -boot order=cd $net $disk -cdrom $cdimage $* } # - - - - - - - - - - - - - - - - - - - - - - - - - die() { @@ -155,10 +157,31 @@ done fi -case "$1" in - pxe) boot_pxe ;; - cd) boot_cd $2 ;; - disk) boot_disk $2 ;; +# Loop through parameters until '--' to pass the remainder to kvm. +# The preceding parameters are stored in $param1 & $param2 +# param1 = cd|pxe|pxe ; param2 = diskimage | imagename +param1="" +param2="" +while test ${#} -gt 0 +do + echo "param... $1" + if [ "$1" = "--" ]; then + shift + break + fi + param1="$param2" + param2="$1" + shift +done +if [ -z "$param1" ]; then + param1="$param2" + param2="" +fi + +case "$param1" in + pxe) boot_pxe $*;; + cd) boot_cd $param2 $*;; + disk) boot_disk $param2 $* ;; *) echo "Missing argument." >&2 usage
--- /usr/bin/fai-kvm 2019-03-27 22:44:02.000000000 +0100 +++ ./fai-kvm 2019-05-28 16:22:12.634678582 +0200 @@ -23,27 +23,29 @@ boot_disk() { # boot from disk - [ -n "$1" ] && disk=$1 + [ -n "$2" ] && disk=$2 + shift; shift case "$disk" in *.raw) f=",format=raw" ;; esac set -x - kvm $gopt -boot order=c $net -drive file=$disk,if=virtio$f + kvm $gopt -boot order=c $net -drive file=$disk,if=virtio$f $* } # - - - - - - - - - - - - - - - - - - - - - - - - - boot_pxe() { - + shift # PXE boot set -x - kvm $gopt -boot order=nc $net $disk + kvm $gopt -boot order=nc $net $disk $* } # - - - - - - - - - - - - - - - - - - - - - - - - - boot_cd() { - [ -n "$1" ] && cdimage=$1 + [ -n "$2" ] && cdimage=$2 + shift; shift # boot fai-cd set -x - kvm $gopt -boot order=cd $net $disk -cdrom $cdimage + kvm $gopt -boot order=cd $net $disk -cdrom $cdimage $* } # - - - - - - - - - - - - - - - - - - - - - - - - - die() { @@ -156,9 +158,9 @@ fi case "$1" in - pxe) boot_pxe ;; - cd) boot_cd $2 ;; - disk) boot_disk $2 ;; + pxe) boot_pxe $*;; + cd) boot_cd $*;; + disk) boot_disk $* ;; *) echo "Missing argument." >&2 usage