summaryrefslogtreecommitdiffstats
path: root/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env')
-rwxr-xr-xremote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env33
1 files changed, 12 insertions, 21 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
index ba3122a1..cf94b3a2 100755
--- a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
@@ -30,21 +30,6 @@ VMCHOOSER_DIR="/opt/openslx/vmchooser"
VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
DHCP_NAT_CONF="/opt/openslx/vmchooser/config/udhcpd-nat1.conf"
-mkdir -p "${VMCHOOSER_DIR}/data/loopimg"
-mkdir -p "${VMCHOOSER_DIR}/fd-loop" -m 1777
-
-# mount a clean tempfs (bug in UnionFS prevents loopmount to work)
-grep -qE "unionfs |aufs " /proc/mounts && \
- mount -n -o size=1500k -t tmpfs vm-loopimg "${VMCHOOSER_DIR}/data/loopimg"
-
-# create an empty floppy image of 1.44 MByte size
-dd "if=/dev/zero" "of=${VMCHOOSER_DIR}/data/loopimg/fd.img" count=2880 bs=512 2>/dev/null
-chmod 0777 "${VMCHOOSER_DIR}/data/loopimg/fd.img"
-
-# use dos formatter copied into stage3
-mkdosfs "${VMCHOOSER_DIR}/data/loopimg/fd.img"
-mount -n -t msdos -o loop,umask=000 "${VMCHOOSER_DIR}/data/loopimg/fd.img" "${VMCHOOSER_DIR}/fd-loop"
-
# setup more scratch space for virtual machines, if configured
mkdir -p /tmp/virt /var/log/samba /run/samba
@@ -168,17 +153,23 @@ echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
### iptables -t nat -A POSTROUTING -o br0 -s 192.168.0.0/16 -j MASQUERADE
for wait in 1 1 2 2 3 end; do
- grep '^SLX_DNS' "/opt/openslx/config" > /dev/null && break
- [ "$wait" == "end" ] && echo "No DNS config found, using google dns" && break
- echo "Waiting for DNS config.."
+ [ -n "$SLX_DNS" ] && [ -n "$SLX_NET_SEARCH" ] && break
+ if [ "$wait" == "end" ]; then
+ echo "No DNS config found, using google dns"
+ break
+ fi
+ echo "Waiting for DNS & search-domain config.."
sleep "$wait"
+ . /opt/openslx/config
done
# read the DNS configuration and configure the udhcpd
-[ -z "${SLX_DNS}" ] && SLX_DNS="8.8.8.8"
-sed -i "s,DNSSERVER,${SLX_DNS},;s,DOMAIN,${SLX_NET_DOMAIN}," \
- "${DHCP_NAT_CONF}"
+[ -z "${SLX_DNS}" ] && SLX_DNS="8.8.8.8 8.8.4.4"
+[ -z "${SLX_NET_DOMAIN}" ] && SLX_NET_DOMAIN="virtual.site"
+[ -z "${SLX_NET_SEARCH}" ] && SLX_NET_SEARCH="virtual.site"
+sed -i "s#%DNSSERVER%#${SLX_DNS}#;s#%DOMAIN%#${SLX_NET_DOMAIN}#;s#%SEARCH%#${SLX_NET_SEARCH}#" "${DHCP_NAT_CONF}"
+# Make sure the primary vm running (we most likely never run more than one at a time anyways) always gets the same ip
echo "static_lease $(echo "$macaddrprefix:$macaddrsuffix" | sed 's/%VMID%/01/') 192.168.101.20" >> "${DHCP_NAT_CONF}"
mkdir -p /var/lib/udhcpd