-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_aliases.qemu
26 lines (24 loc) · 1.51 KB
/
.bash_aliases.qemu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# vim: ft=bash noet:
! declare 2>&1 | grep -wq ^colors= && [ $BASH_VERSINFO -ge 4 ] && source $initDir/.colors
test "$debug" -gt 0 && echo "=> Running $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal ..."
qemu=qemu-system-$archi
if type -P $qemu >/dev/null 2>&1;then
bridgeInterfaceList=$(\ls /sys/class/net | egrep "br[0-9]" | paste -s)
bridgeInterfaceRegExp=$(\ls /sys/class/net | egrep "br[0-9]" | paste -sd "|")
type -P kvm >/dev/null 2>&1 && kvm=kvm || kvm="$qemu -enable-kvm"
test -n "$bridgeInterfaceRegExp" && kvmBridge=$(printf -- "-net bridge,br=%s " $bridgeInterfaceList)
# reDirOption="-redir tcp:2222::22" # deprecated since qemu >=2.9
reDirOption="-nic user,hostfwd=tcp::5022-:22"
kvmBoot="sudo -b $kvm -m 1G $kvmBridge -net nic,model=virtio $reDirOption"
kvmBootWithOldNIC="sudo -b $kvm -m 1G $kvmBridge -net nic,model=pcnet $reDirOption"
alias testLiveIso_BIOS="$kvmBoot -cdrom"
alias testLiveIso_UEFI="$kvmBoot -bios /usr/share/qemu/OVMF.fd -cdrom"
alias testLiveUSB_BIOS="$kvmBoot -hda"
alias testLiveUSB_UEFI="$kvmBoot -bios /usr/share/qemu/OVMF.fd -hda"
alias virtioKernelConfig='grep VIRTIO /boot/config-$(uname -r)'
alias virtualisation="kvm-ok.sh"
test -n "$bridgeInterfaceRegExp" && { cat /etc/qemu/bridge.conf | egrep -q $bridgeInterfaceRegExp 2>/dev/null || echo "=> INFO : You need to add and allow <$bridgeInterfaceRegExp> to your /etc/qemu/bridge.conf file."; }
unset bridgeInterfaceRegExp
fi
set +x
test "$debug" -gt 0 && echo "=> END of $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal"