Print more debug info

Print more debug info
This commit is contained in:
Kroese 2023-05-02 00:06:40 +02:00 committed by GitHub
commit ca140b74a0
5 changed files with 30 additions and 11 deletions

View File

@ -1,9 +1,7 @@
<h1 align="center">Virtual DSM for Docker
<br />
<h1 align="center">Virtual DSM for Docker<br />
<div align="center">
<img src="https://github.com/kroese/virtual-dsm/raw/master/.github/screen.jpg" title="Screenshot" style="max-width:100%;" width="432" />
</div>
<div align="center">
[![Build]][build_url]

View File

@ -31,6 +31,8 @@ TMP="$STORAGE/tmp"
RD="$TMP/rd.gz"
rm -rf "$TMP" && mkdir -p "$TMP"
[ "$DEBUG" = "Y" ] && set -x
LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"
{ curl -r 64493568-69886247 -sfk -o "$RD" "$LOC"; rc=$?; } || :
@ -205,3 +207,6 @@ mv -f "$BOOT" "$STORAGE"/"$BASE".boot.img
mv -f "$SYSTEM" "$STORAGE"/"$BASE".system.img
rm -rf "$TMP"
{ set +x; } 2>/dev/null
[ "$DEBUG" = "Y" ] && echo

View File

@ -25,6 +25,7 @@ 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/)
[ "$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
@ -41,8 +42,6 @@ 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 2> /dev/null ; rc=$?; } || :
if (( rc != 0 )); then
@ -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}"
@ -111,6 +115,7 @@ configureDHCP() {
configureNAT () {
VM_NET_IP='20.20.20.21'
[ "$DEBUG" = "Y" ] && set -x
#Create bridge with static IP for the VM guest
@ -139,6 +144,9 @@ 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 2> /dev/null ; rc=$?; } || :
@ -188,9 +196,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
}
# ######################################

View File

@ -72,7 +72,7 @@ EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,ad
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
(
@ -80,6 +80,8 @@ set -m
)
set +m
{ set +x; } 2>/dev/null
if (( KERNEL > 4 )); then
pidwait -F "${_QEMU_PID}" & wait $!
else

View File

@ -31,12 +31,14 @@ HOST_ARGS+=("-cpu_arch=${HOST_CPU}")
[ -n "$HOST_TIMESTAMP" ] && HOST_ARGS+=("-ts=${HOST_TIMESTAMP}")
if [ "$DEBUG" = "Y" ]; then
echo -n "./run/host.bin "
echo "${HOST_ARGS[*]}" && echo
set -x
./run/host.bin "${HOST_ARGS[@]}" &
{ set +x; } 2>/dev/null
echo
else
./run/host.bin "${HOST_ARGS[@]}" > /dev/null 2>&1 &
fi
./run/host.bin "${HOST_ARGS[@]}" > /dev/null 2>&1 &
# Configure serial ports
SERIAL_OPTS="\