Unverified Commit 09ca3bf1 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Add debug trace option (#1038)

parent 6cac45c3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -522,7 +522,9 @@ addDevice () {
  return 0
}

html "Initializing disks..."
msg="Initializing disks..."
html "$msg"
[[ "$DEBUG" == [Yy1]* ]] && echo "$msg"

[ -z "${DISK_OPTS:-}" ] && DISK_OPTS=""
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE="scsi"
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,10 @@ if [[ "$GPU" != [Yy1]* || "$CPU_VENDOR" != "GenuineIntel" || "$ARCH" != "amd64"

fi

msg="Configuring display drivers..."
html "$msg"
[[ "$DEBUG" == [Yy1]* ]] && echo "$msg"

DISPLAY_OPTS="-display egl-headless,rendernode=$RENDERNODE"
DISPLAY_OPTS+=" -vga $VGA"

+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ set -Eeuo pipefail

cd /run

. start.sh      # Placeholder
. utils.sh      # Load functions
. reset.sh      # Initialize system
. install.sh    # Run installation
+6 −4
Original line number Diff line number Diff line
@@ -31,8 +31,9 @@ if [ -n "$URL" ] && [ ! -s "$FILE" ] && [ ! -d "$DIR" ]; then
  BASE=$(basename "$URL" .pat)
  if [ ! -s "$STORAGE/$BASE.system.img" ]; then
    BASE=$(basename "${URL%%\?*}" .pat)
    : "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
    BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
    BASE="${BASE//+/ }"
    printf -v BASE '%b' "${BASE//%/\\x}"
    BASE="${BASE//[!A-Za-z0-9._-]/_}"
  fi
  if [[ "${URL,,}" != "http"* && "${URL,,}" != "file:"* ]] ; then
    [ ! -s "$STORAGE/$BASE.pat" ] && error "Invalid URL:  $URL" && exit 65
@@ -65,8 +66,9 @@ fi

if [ ! -s "$FILE" ]; then
  BASE=$(basename "${URL%%\?*}" .pat)
  : "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
  BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
  BASE="${BASE//+/ }"
  printf -v BASE '%b' "${BASE//%/\\x}"
  BASE="${BASE//[!A-Za-z0-9._-]/_}"
fi

if [[ "$URL" != "file://$STORAGE/$BASE.pat" ]]; then
+9 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ ADD_ERR="Please add the following setting to your container:"

configureDHCP() {

  [[ "$DEBUG" == [Yy1]* ]] && echo "Configuring MACVTAP networking..."

  # Create the necessary file structure for /dev/vhost-net
  if [ ! -c /dev/vhost-net ]; then
    if mknod /dev/vhost-net c 10 238; then
@@ -125,6 +127,7 @@ configureDNS() {
  DNSMASQ_OPTS+=" --address=/host.lan/${VM_NET_IP%.*}.1"

  DNSMASQ_OPTS=$(echo "$DNSMASQ_OPTS" | sed 's/\t/ /g' | tr -s ' ' | sed 's/^ *//')
  [[ "$DEBUG" == [Yy1]* ]] && echo "Starting Dnsmasq daemon..."

  if [[ "${DEBUG_DNS:-}" == [Yy1]* ]]; then
   DNSMASQ_OPTS+=" -d"
@@ -188,6 +191,8 @@ getHostPorts() {

configureUser() {

  [[ "$DEBUG" == [Yy1]* ]] && echo "Configuring SLIRP networking..."

  if [ -z "$IP6" ]; then
    NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
  else
@@ -206,6 +211,8 @@ configureNAT() {
  local tuntap="TUN device is missing. $ADD_ERR --device /dev/net/tun"
  local tables="The 'ip_tables' kernel module is not loaded. Try this command: sudo modprobe ip_tables iptable_nat"

  [[ "$DEBUG" == [Yy1]* ]] && echo "Configuring NAT networking..."

  # Create the necessary file structure for /dev/net/tun
  if [ ! -c /dev/net/tun ]; then
    [[ "$PODMAN" == [Yy1]* ]] && return 1
@@ -487,6 +494,8 @@ if [[ "$NETWORK" == [Nn]* ]]; then
  return 0
fi

[[ "$DEBUG" == [Yy1]* ]] && echo "Retrieving network information..."

getInfo
html "Initializing network..."

Loading