mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-10-12 05:34:53 +08:00
feat: Add debug trace option (#1038)
This commit is contained in:
parent
6cac45c397
commit
09ca3bf118
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -6,6 +6,7 @@ set -Eeuo pipefail
|
||||
|
||||
cd /run
|
||||
|
||||
. start.sh # Placeholder
|
||||
. utils.sh # Load functions
|
||||
. reset.sh # Initialize system
|
||||
. install.sh # Run installation
|
||||
|
@ -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
|
||||
|
@ -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..."
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
set -Eeuo pipefail
|
||||
|
||||
trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR
|
||||
[[ "${TRACE:-}" == [Yy1]* ]] && set -o functrace && trap 'echo "# $BASH_COMMAND" >&2' DEBUG
|
||||
|
||||
[ ! -f "/run/entry.sh" ] && error "Script must run inside Docker container!" && exit 11
|
||||
[ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12
|
||||
|
4
src/start.sh
Normal file
4
src/start.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Override this placeholder file using a Docker bind to execute a script during startup!
|
Loading…
x
Reference in New Issue
Block a user