mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Automatically expose the VM via ssh
This commit is contained in:
parent
292686c3ca
commit
0a1a7b3851
1 changed files with 14 additions and 5 deletions
19
quickemu.sh
19
quickemu.sh
|
@ -137,20 +137,29 @@ function vm_boot() {
|
||||||
echo " - Monitor: ${xres}x${yres}"
|
echo " - Monitor: ${xres}x${yres}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local SAMBA=""
|
local NET=""
|
||||||
# If smbd is available, export $HOME to the guest via samba
|
# If smbd is available, export $HOME to the guest via samba
|
||||||
if [ "${ENGINE}" == "virgil" ] && [ -e /snap/qemu-virgil/current/usr/sbin/smbd ]; then
|
if [ "${ENGINE}" == "virgil" ] && [ -e /snap/qemu-virgil/current/usr/sbin/smbd ]; then
|
||||||
SAMBA=",smb=${HOME}"
|
NET=",smb=${HOME}"
|
||||||
elif [ "${ENGINE}" == "system-x86_64" ] && [ -e /usr/sbin/smbd ]; then
|
elif [ "${ENGINE}" == "system-x86_64" ] && [ -e /usr/sbin/smbd ]; then
|
||||||
SAMBA=",smb=${HOME}"
|
NET=",smb=${HOME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${SAMBA}" ]; then
|
if [ -n "${NET}" ]; then
|
||||||
echo " - smbd: ${HOME} will be exported to the guest via smb://10.0.2.4/qemu"
|
echo " - smbd: ${HOME} will be exported to the guest via smb://10.0.2.4/qemu"
|
||||||
else
|
else
|
||||||
echo " - smbd: ${HOME} will not be exported to the guest. 'smbd' not found."
|
echo " - smbd: ${HOME} will not be exported to the guest. 'smbd' not found."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Find a free port to expose ssh to the guest
|
||||||
|
local PORT=$(get_port)
|
||||||
|
if [ -n "${PORT}" ]; then
|
||||||
|
NET="${NET},hostfwd=tcp::${PORT}-:22"
|
||||||
|
echo " - ssh: ${PORT}/tcp is connected. Login via 'ssh user@localhost -p ${PORT}'"
|
||||||
|
else
|
||||||
|
echo " - ssh: All ports for exposing ssh have been exhausted."
|
||||||
|
fi
|
||||||
|
|
||||||
#echo " - QEMU: qemu-${ENGINE}"
|
#echo " - QEMU: qemu-${ENGINE}"
|
||||||
# Boot the iso image
|
# Boot the iso image
|
||||||
qemu-${ENGINE} -name ${VMNAME},process=${VMNAME} \
|
qemu-${ENGINE} -name ${VMNAME},process=${VMNAME} \
|
||||||
|
@ -163,7 +172,7 @@ function vm_boot() {
|
||||||
-m ${ram} \
|
-m ${ram} \
|
||||||
-smp ${cores} \
|
-smp ${cores} \
|
||||||
-net nic,model=virtio \
|
-net nic,model=virtio \
|
||||||
-net user"${SAMBA}" \
|
-net user"${NET}" \
|
||||||
-rtc base=localtime,clock=host \
|
-rtc base=localtime,clock=host \
|
||||||
-serial mon:stdio \
|
-serial mon:stdio \
|
||||||
-soundhw hda \
|
-soundhw hda \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue