Print more debug info
Print more debug info
This commit is contained in:
commit
6525cd5d98
3 changed files with 27 additions and 8 deletions
|
@ -13,6 +13,8 @@ else
|
|||
PROGRESS="--progress=dot:giga"
|
||||
fi
|
||||
|
||||
[ "$DEBUG" = "Y" ] && set -x
|
||||
|
||||
{ wget "$BOOT" -O "$TMP" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
|
||||
(( rc != 0 )) && echo "ERROR: Failed to download ${BOOT}, reason: $rc" && exit 60
|
||||
|
||||
|
@ -27,3 +29,6 @@ fi
|
|||
FILE="$STORAGE/boot.img"
|
||||
|
||||
mv -f "$TMP" "$FILE"
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
[ "$DEBUG" = "Y" ] && echo
|
||||
|
|
|
@ -25,7 +25,8 @@ configureDHCP() {
|
|||
NETWORK=$(ip -o route | grep "${VM_NET_DEV}" | grep -v default | awk '{print $1}')
|
||||
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
||||
|
||||
{ ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge > /dev/null 2>&1 ; rc=$?; } || :
|
||||
[ "$DEBUG" = "Y" ] && set -x
|
||||
{ ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge 2> /dev/null ; rc=$?; } || :
|
||||
|
||||
if (( rc != 0 )); then
|
||||
echo -n "ERROR: Capability NET_ADMIN has not been set ($rc/1). Please add the "
|
||||
|
@ -41,9 +42,7 @@ configureDHCP() {
|
|||
ip route add "${NETWORK}" dev "${VM_NET_VLAN}" metric 0
|
||||
ip route add default via "${GATEWAY}"
|
||||
|
||||
echo "INFO: Acquiring an IP address via DHCP using MAC address ${VM_NET_MAC}..."
|
||||
|
||||
{ ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge > /dev/null 2>&1 ; rc=$?; } || :
|
||||
{ ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge 2> /dev/null ; rc=$?; } || :
|
||||
|
||||
if (( rc != 0 )); then
|
||||
echo -n "ERROR: Capability NET_ADMIN has not been set ($rc/2). Please add the "
|
||||
|
@ -55,6 +54,8 @@ configureDHCP() {
|
|||
ip address flush "${VM_NET_DEV}"
|
||||
ip address flush "${VM_NET_TAP}"
|
||||
|
||||
echo "INFO: Acquiring an IP address via DHCP using MAC address ${VM_NET_MAC}..."
|
||||
|
||||
DHCP_IP=$(dhclient -v "${VM_NET_TAP}" 2>&1 | grep ^bound | cut -d' ' -f3)
|
||||
|
||||
if [[ "${DHCP_IP}" == [0-9.]* ]]; then
|
||||
|
@ -65,6 +66,9 @@ configureDHCP() {
|
|||
|
||||
ip address flush "${VM_NET_TAP}"
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
[ "$DEBUG" = "Y" ] && echo
|
||||
|
||||
TAP_NR=$(</sys/class/net/"${VM_NET_TAP}"/ifindex)
|
||||
TAP_PATH="/dev/tap${TAP_NR}"
|
||||
|
||||
|
@ -108,10 +112,11 @@ configureDHCP() {
|
|||
configureNAT () {
|
||||
|
||||
VM_NET_IP='20.20.20.21'
|
||||
[ "$DEBUG" = "Y" ] && set -x
|
||||
|
||||
#Create bridge with static IP for the VM guest
|
||||
|
||||
{ ip link add dev dockerbridge type bridge > /dev/null 2>&1 ; rc=$?; } || :
|
||||
{ ip link add dev dockerbridge type bridge 2> /dev/null ; rc=$?; } || :
|
||||
|
||||
if (( rc != 0 )); then
|
||||
echo -n "ERROR: Capability NET_ADMIN has not been set ($rc/3). Please add the "
|
||||
|
@ -136,9 +141,12 @@ configureNAT () {
|
|||
iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill || true
|
||||
fi
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
[ "$DEBUG" = "Y" ] && echo
|
||||
|
||||
#Check port forwarding flag
|
||||
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null 2>&1; rc=$?; } || :
|
||||
{ sysctl -w net.ipv4.ip_forward=1 2> /dev/null ; rc=$?; } || :
|
||||
if (( rc != 0 )); then
|
||||
echo -n "ERROR: IP forwarding is disabled ($rc). Please add the following "
|
||||
echo "docker setting to your container: --sysctl net.ipv4.ip_forward=1" && exit 24
|
||||
|
@ -182,9 +190,13 @@ configureNAT () {
|
|||
fi
|
||||
|
||||
DNSMASQ_OPTS=$(echo "$DNSMASQ_OPTS" | sed 's/\t/ /g' | tr -s ' ' | sed 's/^ *//')
|
||||
[ "$DEBUG" = "Y" ] && echo "$DNSMASQ $DNSMASQ_OPTS" && echo
|
||||
|
||||
[ "$DEBUG" = "Y" ] && set -x
|
||||
|
||||
$DNSMASQ ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS}
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
[ "$DEBUG" = "Y" ] && echo
|
||||
}
|
||||
|
||||
# ######################################
|
||||
|
|
|
@ -59,7 +59,7 @@ EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0 -object rng-random,id=rng0,fi
|
|||
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS}"
|
||||
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')
|
||||
|
||||
[ "$DEBUG" = "Y" ] && echo "qemu-system-x86_64 ${ARGS}" && echo
|
||||
[ "$DEBUG" = "Y" ] && set -x
|
||||
|
||||
set -m
|
||||
(
|
||||
|
@ -67,6 +67,8 @@ set -m
|
|||
)
|
||||
set +m
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
if (( KERNEL > 4 )); then
|
||||
pidwait -F "${_QEMU_PID}" & wait $!
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue