Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dc022ddf8 | |||
| 6623e159f5 | |||
| bbd6d009f8 | |||
| 6c2b188ec9 | |||
| 14505ef24a | |||
| 4f20c9246d |
@@ -24,6 +24,8 @@ var supportBundleServices = []string{
|
|||||||
"bee-selfheal.service",
|
"bee-selfheal.service",
|
||||||
"bee-selfheal.timer",
|
"bee-selfheal.timer",
|
||||||
"bee-sshsetup.service",
|
"bee-sshsetup.service",
|
||||||
|
"display-manager.service",
|
||||||
|
"lightdm.service",
|
||||||
"nvidia-dcgm.service",
|
"nvidia-dcgm.service",
|
||||||
"nvidia-fabricmanager.service",
|
"nvidia-fabricmanager.service",
|
||||||
}
|
}
|
||||||
@@ -44,12 +46,128 @@ var supportBundleCommands = []struct {
|
|||||||
{name: "system/mount.txt", cmd: []string{"mount"}},
|
{name: "system/mount.txt", cmd: []string{"mount"}},
|
||||||
{name: "system/df-h.txt", cmd: []string{"df", "-h"}},
|
{name: "system/df-h.txt", cmd: []string{"df", "-h"}},
|
||||||
{name: "system/dmesg.txt", cmd: []string{"dmesg"}},
|
{name: "system/dmesg.txt", cmd: []string{"dmesg"}},
|
||||||
|
{name: "system/dmesg-gui-video-input.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if command -v dmesg >/dev/null 2>&1; then
|
||||||
|
dmesg | grep -iE 'nvidia|drm|fb|framebuffer|vesa|efi|lightdm|Xorg|input|hid|usb|keyboard|mouse|virtual keyboard|virtual mouse|ami|aspeed|ast' || echo "no GUI/video/input kernel messages found"
|
||||||
|
else
|
||||||
|
echo "dmesg not found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
{name: "system/kernel-aer-nvidia.txt", cmd: []string{"sh", "-c", `
|
{name: "system/kernel-aer-nvidia.txt", cmd: []string{"sh", "-c", `
|
||||||
if command -v dmesg >/dev/null 2>&1; then
|
if command -v dmesg >/dev/null 2>&1; then
|
||||||
dmesg | grep -iE 'AER|NVRM|Xid|pcieport|nvidia' || echo "no AER/NVRM/Xid kernel messages found"
|
dmesg | grep -iE 'AER|NVRM|Xid|pcieport|nvidia' || echo "no AER/NVRM/Xid kernel messages found"
|
||||||
else
|
else
|
||||||
echo "dmesg not found"
|
echo "dmesg not found"
|
||||||
fi
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/loginctl-sessions.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if command -v loginctl >/dev/null 2>&1; then
|
||||||
|
loginctl list-sessions 2>&1 || true
|
||||||
|
else
|
||||||
|
echo "loginctl not found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/loginctl-seats.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if command -v loginctl >/dev/null 2>&1; then
|
||||||
|
loginctl list-seats 2>&1 || true
|
||||||
|
echo
|
||||||
|
for seat in $(loginctl list-seats --no-legend 2>/dev/null | awk '{print $1}'); do
|
||||||
|
echo "=== $seat ==="
|
||||||
|
loginctl seat-status "$seat" 2>&1 || true
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "loginctl not found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/ps-gui.txt", cmd: []string{"sh", "-c", `
|
||||||
|
ps -ef | grep -iE 'lightdm|Xorg|X$|openbox|chromium|chrome|xinit|xsession' | grep -v grep || echo "no GUI processes found"
|
||||||
|
`}},
|
||||||
|
{name: "system/lspci-video-vv.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if ! command -v lspci >/dev/null 2>&1; then
|
||||||
|
echo "lspci not found"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
found=0
|
||||||
|
for dev in $(lspci -Dn | awk '$2 ~ /^03(00|02):$/ {print $1}'); do
|
||||||
|
found=1
|
||||||
|
echo "=== $dev ==="
|
||||||
|
lspci -s "$dev" -vv 2>&1 || true
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
if [ "$found" -eq 0 ]; then
|
||||||
|
echo "no display-class PCI devices found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/proc-fb.txt", cmd: []string{"cat", "/proc/fb"}},
|
||||||
|
{name: "system/drm-cards.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if [ -d /sys/class/drm ]; then
|
||||||
|
for path in /sys/class/drm/card*; do
|
||||||
|
[ -e "$path" ] || continue
|
||||||
|
card=$(basename "$path")
|
||||||
|
echo "=== $card ==="
|
||||||
|
for f in status enabled dpms modes; do
|
||||||
|
[ -r "$path/$f" ] && printf " %-8s %s\n" "$f" "$(cat "$path/$f" 2>/dev/null)"
|
||||||
|
done
|
||||||
|
device=$(readlink -f "$path/device" 2>/dev/null || true)
|
||||||
|
[ -n "$device" ] && echo " device ${device##*/}"
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "/sys/class/drm not present"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/input-devices.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if [ -r /proc/bus/input/devices ]; then
|
||||||
|
cat /proc/bus/input/devices
|
||||||
|
else
|
||||||
|
echo "/proc/bus/input/devices not readable"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/udevadm-input.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if ! command -v udevadm >/dev/null 2>&1; then
|
||||||
|
echo "udevadm not found"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
found=0
|
||||||
|
for dev in /dev/input/event*; do
|
||||||
|
[ -e "$dev" ] || continue
|
||||||
|
found=1
|
||||||
|
echo "=== $dev ==="
|
||||||
|
udevadm info --query=all --name="$dev" 2>&1 || true
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
if [ "$found" -eq 0 ]; then
|
||||||
|
echo "no /dev/input/event* devices found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/xinput-list.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if command -v xinput >/dev/null 2>&1; then
|
||||||
|
DISPLAY=:0 xinput --list 2>&1 || true
|
||||||
|
else
|
||||||
|
echo "xinput not found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/libinput-list-devices.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if command -v libinput >/dev/null 2>&1; then
|
||||||
|
libinput list-devices 2>&1 || true
|
||||||
|
else
|
||||||
|
echo "libinput not found"
|
||||||
|
fi
|
||||||
|
`}},
|
||||||
|
{name: "system/systemctl-gui-units.txt", cmd: []string{"sh", "-c", `
|
||||||
|
if ! command -v systemctl >/dev/null 2>&1; then
|
||||||
|
echo "systemctl not found"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "=== unit files ==="
|
||||||
|
systemctl list-unit-files --no-pager --all 'lightdm*' 'display-manager*' 2>&1 || true
|
||||||
|
echo
|
||||||
|
echo "=== active units ==="
|
||||||
|
systemctl list-units --no-pager --all 'lightdm*' 'display-manager*' 2>&1 || true
|
||||||
|
echo
|
||||||
|
echo "=== failed units ==="
|
||||||
|
systemctl --failed --no-pager 2>&1 | grep -iE 'lightdm|display-manager|Xorg' || echo "no failed GUI units"
|
||||||
`}},
|
`}},
|
||||||
{name: "system/nvidia-smi-q.txt", cmd: []string{"nvidia-smi", "-q"}},
|
{name: "system/nvidia-smi-q.txt", cmd: []string{"nvidia-smi", "-q"}},
|
||||||
{name: "system/nvidia-smi-topo.txt", cmd: []string{"sh", "-c", `
|
{name: "system/nvidia-smi-topo.txt", cmd: []string{"sh", "-c", `
|
||||||
@@ -236,6 +354,13 @@ var supportBundleOptionalFiles = []struct {
|
|||||||
}{
|
}{
|
||||||
{name: "system/kern.log", src: "/var/log/kern.log"},
|
{name: "system/kern.log", src: "/var/log/kern.log"},
|
||||||
{name: "system/syslog.txt", src: "/var/log/syslog"},
|
{name: "system/syslog.txt", src: "/var/log/syslog"},
|
||||||
|
{name: "system/Xorg.0.log", src: "/var/log/Xorg.0.log"},
|
||||||
|
{name: "system/Xorg.0.log.old", src: "/var/log/Xorg.0.log.old"},
|
||||||
|
{name: "system/lightdm/lightdm.log", src: "/var/log/lightdm/lightdm.log"},
|
||||||
|
{name: "system/lightdm/x-0.log", src: "/var/log/lightdm/x-0.log"},
|
||||||
|
{name: "system/lightdm/x-0-greeter.log", src: "/var/log/lightdm/x-0-greeter.log"},
|
||||||
|
{name: "system/home-bee-xsession-errors.log", src: "/home/bee/.xsession-errors"},
|
||||||
|
{name: "system/home-bee-chromium-debug.log", src: "/tmp/bee-chrome/chrome_debug.log"},
|
||||||
{name: "system/fabricmanager.log", src: "/var/log/fabricmanager.log"},
|
{name: "system/fabricmanager.log", src: "/var/log/fabricmanager.log"},
|
||||||
{name: "system/nvlsm.log", src: "/var/log/nvlsm.log"},
|
{name: "system/nvlsm.log", src: "/var/log/nvlsm.log"},
|
||||||
{name: "system/fabricmanager/fabricmanager.log", src: "/var/log/fabricmanager/fabricmanager.log"},
|
{name: "system/fabricmanager/fabricmanager.log", src: "/var/log/fabricmanager/fabricmanager.log"},
|
||||||
|
|||||||
@@ -1294,8 +1294,8 @@ const loadingPageHTML = `<!DOCTYPE html>
|
|||||||
*{margin:0;padding:0;box-sizing:border-box}
|
*{margin:0;padding:0;box-sizing:border-box}
|
||||||
html,body{height:100%;background:#0f1117;display:flex;align-items:center;justify-content:center;font-family:'Courier New',monospace;color:#e2e8f0}
|
html,body{height:100%;background:#0f1117;display:flex;align-items:center;justify-content:center;font-family:'Courier New',monospace;color:#e2e8f0}
|
||||||
.wrap{text-align:center;width:420px}
|
.wrap{text-align:center;width:420px}
|
||||||
.logo{font-size:11px;line-height:1.4;color:#f6c90e;margin-bottom:6px;white-space:pre;text-align:left}
|
.brand{font-size:22px;letter-spacing:.18em;color:#f6c90e;margin-bottom:6px;text-align:left}
|
||||||
.subtitle{font-size:12px;color:#a0aec0;text-align:left;margin-bottom:24px;padding-left:2px}
|
.subtitle{font-size:12px;color:#a0aec0;text-align:left;margin-bottom:24px}
|
||||||
.spinner{width:36px;height:36px;border:3px solid #2d3748;border-top-color:#f6c90e;border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 14px}
|
.spinner{width:36px;height:36px;border:3px solid #2d3748;border-top-color:#f6c90e;border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 14px}
|
||||||
.spinner.hidden{display:none}
|
.spinner.hidden{display:none}
|
||||||
@keyframes spin{to{transform:rotate(360deg)}}
|
@keyframes spin{to{transform:rotate(360deg)}}
|
||||||
@@ -1313,12 +1313,7 @@ td:first-child{color:#718096;width:55%}
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<div class="logo"> ███████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ███████╗███████╗
|
<div class="brand">EASY BEE</div>
|
||||||
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝ ██╔══██╗██╔════╝██╔════╝
|
|
||||||
█████╗ ███████║███████╗ ╚████╔╝ █████╗██████╔╝█████╗ █████╗
|
|
||||||
██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ╚════╝██╔══██╗██╔══╝ ██╔══╝
|
|
||||||
███████╗██║ ██║███████║ ██║ ██████╔╝███████╗███████╗
|
|
||||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝</div>
|
|
||||||
<div class="subtitle">Hardware Audit LiveCD</div>
|
<div class="subtitle">Hardware Audit LiveCD</div>
|
||||||
<div class="spinner" id="spin"></div>
|
<div class="spinner" id="spin"></div>
|
||||||
<div class="status" id="st">Connecting to bee-web...</div>
|
<div class="status" id="st">Connecting to bee-web...</div>
|
||||||
@@ -1328,8 +1323,20 @@ td:first-child{color:#718096;width:55%}
|
|||||||
<script>
|
<script>
|
||||||
(function(){
|
(function(){
|
||||||
var gone = false;
|
var gone = false;
|
||||||
|
var pollStarted = false;
|
||||||
|
var fallbackOpenTimer = null;
|
||||||
|
var AUTO_OPEN_DELAY_MS = 15000;
|
||||||
function go(){ if(!gone){gone=true;window.location.replace('/');} }
|
function go(){ if(!gone){gone=true;window.location.replace('/');} }
|
||||||
|
|
||||||
|
function scheduleFallbackOpen(){
|
||||||
|
if(fallbackOpenTimer!==null) return;
|
||||||
|
fallbackOpenTimer=setTimeout(function(){
|
||||||
|
document.getElementById('spin').className='spinner hidden';
|
||||||
|
document.getElementById('st').textContent='Startup checks are taking too long — opening app...';
|
||||||
|
go();
|
||||||
|
},AUTO_OPEN_DELAY_MS);
|
||||||
|
}
|
||||||
|
|
||||||
function icon(s){
|
function icon(s){
|
||||||
if(s==='active') return '<span class="ok">● active</span>';
|
if(s==='active') return '<span class="ok">● active</span>';
|
||||||
if(s==='failed') return '<span class="fail">✕ failed</span>';
|
if(s==='failed') return '<span class="fail">✕ failed</span>';
|
||||||
@@ -1361,6 +1368,7 @@ function pollServices(){
|
|||||||
tbl.innerHTML=html;
|
tbl.innerHTML=html;
|
||||||
if(allSettled(svcs)){
|
if(allSettled(svcs)){
|
||||||
clearInterval(pollTimer);
|
clearInterval(pollTimer);
|
||||||
|
if(fallbackOpenTimer!==null) clearTimeout(fallbackOpenTimer);
|
||||||
document.getElementById('spin').className='spinner hidden';
|
document.getElementById('spin').className='spinner hidden';
|
||||||
document.getElementById('st').textContent='Ready \u2014 opening...';
|
document.getElementById('st').textContent='Ready \u2014 opening...';
|
||||||
setTimeout(go,800);
|
setTimeout(go,800);
|
||||||
@@ -1375,8 +1383,12 @@ function probe(){
|
|||||||
if(r.ok){
|
if(r.ok){
|
||||||
document.getElementById('st').textContent='bee-web running \u2014 checking services...';
|
document.getElementById('st').textContent='bee-web running \u2014 checking services...';
|
||||||
document.getElementById('btn').style.display='';
|
document.getElementById('btn').style.display='';
|
||||||
pollServices();
|
scheduleFallbackOpen();
|
||||||
pollTimer=setInterval(pollServices,1500);
|
if(!pollStarted){
|
||||||
|
pollStarted=true;
|
||||||
|
pollServices();
|
||||||
|
pollTimer=setInterval(pollServices,1500);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('st').textContent='bee-web starting (status '+r.status+')...';
|
document.getElementById('st').textContent='bee-web starting (status '+r.status+')...';
|
||||||
setTimeout(probe,500);
|
setTimeout(probe,500);
|
||||||
|
|||||||
@@ -604,6 +604,25 @@ func TestReadyIsOKWhenAuditPathIsUnset(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadingPageHasFallbackAutoOpen(t *testing.T) {
|
||||||
|
handler := NewHandler(HandlerOptions{})
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
handler.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/loading", nil))
|
||||||
|
if rec.Code != http.StatusOK {
|
||||||
|
t.Fatalf("status=%d body=%s", rec.Code, rec.Body.String())
|
||||||
|
}
|
||||||
|
body := rec.Body.String()
|
||||||
|
for _, needle := range []string{
|
||||||
|
`var AUTO_OPEN_DELAY_MS = 15000;`,
|
||||||
|
`function scheduleFallbackOpen(){`,
|
||||||
|
`Startup checks are taking too long — opening app...`,
|
||||||
|
} {
|
||||||
|
if !strings.Contains(body, needle) {
|
||||||
|
t.Fatalf("loading page missing %q: %s", needle, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestAuditPageRendersViewerFrameAndActions(t *testing.T) {
|
func TestAuditPageRendersViewerFrameAndActions(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
path := filepath.Join(dir, "audit.json")
|
path := filepath.Join(dir, "audit.json")
|
||||||
|
|||||||
@@ -674,175 +674,6 @@ label memtest
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_live_grub_entry() {
|
|
||||||
cfg="$1"
|
|
||||||
live_linux="$(awk '/^[[:space:]]*linux[[:space:]]+\/live\// { print; exit }' "$cfg")"
|
|
||||||
live_initrd="$(awk '/^[[:space:]]*initrd[[:space:]]+\/live\// { print; exit }' "$cfg")"
|
|
||||||
[ -n "$live_linux" ] || return 1
|
|
||||||
[ -n "$live_initrd" ] || return 1
|
|
||||||
|
|
||||||
grub_kernel="$(printf '%s\n' "$live_linux" | awk '{print $2}')"
|
|
||||||
grub_append="$(printf '%s\n' "$live_linux" | cut -d' ' -f3-)"
|
|
||||||
grub_initrd="$(printf '%s\n' "$live_initrd" | awk '{print $2}')"
|
|
||||||
[ -n "$grub_kernel" ] || return 1
|
|
||||||
[ -n "$grub_append" ] || return 1
|
|
||||||
[ -n "$grub_initrd" ] || return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
load_live_build_append() {
|
|
||||||
lb_dir="$1"
|
|
||||||
binary_cfg="$lb_dir/config/binary"
|
|
||||||
[ -f "$binary_cfg" ] || return 1
|
|
||||||
|
|
||||||
# config/binary is generated by live-build and contains shell variable
|
|
||||||
# assignments such as LB_BOOTAPPEND_LIVE="boot=live ...".
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "$binary_cfg"
|
|
||||||
|
|
||||||
[ -n "${LB_BOOTAPPEND_LIVE:-}" ] || return 1
|
|
||||||
live_build_append="$LB_BOOTAPPEND_LIVE"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
extract_live_isolinux_entry() {
|
|
||||||
cfg="$1"
|
|
||||||
isolinux_linux="$(awk '/^[[:space:]]*linux[[:space:]]+\/live\// { print; exit }' "$cfg")"
|
|
||||||
isolinux_initrd="$(awk '/^[[:space:]]*initrd[[:space:]]+\/live\// { print; exit }' "$cfg")"
|
|
||||||
isolinux_append="$(awk '/^[[:space:]]*append[[:space:]]+/ { sub(/^[[:space:]]*append[[:space:]]+/, ""); print; exit }' "$cfg")"
|
|
||||||
[ -n "$isolinux_linux" ] || return 1
|
|
||||||
[ -n "$isolinux_initrd" ] || return 1
|
|
||||||
[ -n "$isolinux_append" ] || return 1
|
|
||||||
|
|
||||||
isolinux_kernel="$(printf '%s\n' "$isolinux_linux" | awk '{print $2}')"
|
|
||||||
isolinux_initrd_path="$(printf '%s\n' "$isolinux_initrd" | awk '{print $2}')"
|
|
||||||
[ -n "$isolinux_kernel" ] || return 1
|
|
||||||
[ -n "$isolinux_initrd_path" ] || return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
write_canonical_grub_cfg() {
|
|
||||||
cfg="$1"
|
|
||||||
kernel="$2"
|
|
||||||
append_live="$3"
|
|
||||||
initrd="$4"
|
|
||||||
|
|
||||||
cat > "$cfg" <<EOF
|
|
||||||
source /boot/grub/config.cfg
|
|
||||||
|
|
||||||
menuentry "EASY-BEE" {
|
|
||||||
linux ${kernel} ${append_live} bee.display=kms bee.nvidia.mode=normal pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
initrd ${initrd}
|
|
||||||
}
|
|
||||||
|
|
||||||
menuentry "EASY-BEE -- load to RAM (toram)" {
|
|
||||||
linux ${kernel} ${append_live} toram bee.display=kms bee.nvidia.mode=normal pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
initrd ${initrd}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ "\${grub_platform}" = "efi" ]; then
|
|
||||||
menuentry "Memory Test (memtest86+)" {
|
|
||||||
chainloader /boot/memtest86+x64.efi
|
|
||||||
}
|
|
||||||
else
|
|
||||||
menuentry "Memory Test (memtest86+)" {
|
|
||||||
linux16 /boot/memtest86+x64.bin
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "\${grub_platform}" = "efi" ]; then
|
|
||||||
menuentry "UEFI Firmware Settings" {
|
|
||||||
fwsetup
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
write_canonical_isolinux_cfg() {
|
|
||||||
cfg="$1"
|
|
||||||
kernel="$2"
|
|
||||||
initrd="$3"
|
|
||||||
append_live="$4"
|
|
||||||
|
|
||||||
cat > "$cfg" <<EOF
|
|
||||||
label live-@FLAVOUR@-normal
|
|
||||||
menu label ^EASY-BEE
|
|
||||||
linux ${kernel}
|
|
||||||
initrd ${initrd}
|
|
||||||
append ${append_live} nomodeset bee.nvidia.mode=normal net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
|
|
||||||
label live-@FLAVOUR@-toram
|
|
||||||
menu label EASY-BEE (^load to RAM)
|
|
||||||
menu default
|
|
||||||
linux ${kernel}
|
|
||||||
initrd ${initrd}
|
|
||||||
append ${append_live} toram nomodeset bee.nvidia.mode=normal net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
|
|
||||||
label live-@FLAVOUR@-gsp-off
|
|
||||||
menu label EASY-BEE (^NVIDIA GSP=off)
|
|
||||||
linux ${kernel}
|
|
||||||
initrd ${initrd}
|
|
||||||
append ${append_live} nomodeset bee.nvidia.mode=gsp-off net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
|
|
||||||
label live-@FLAVOUR@-kms
|
|
||||||
menu label EASY-BEE (^KMS, no nomodeset)
|
|
||||||
linux ${kernel}
|
|
||||||
initrd ${initrd}
|
|
||||||
append ${append_live} bee.nvidia.mode=normal net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
|
|
||||||
label live-@FLAVOUR@-kms-gsp-off
|
|
||||||
menu label EASY-BEE (KMS, ^GSP=off)
|
|
||||||
linux ${kernel}
|
|
||||||
initrd ${initrd}
|
|
||||||
append ${append_live} bee.nvidia.mode=gsp-off net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
|
||||||
|
|
||||||
label live-@FLAVOUR@-failsafe
|
|
||||||
menu label EASY-BEE (^fail-safe)
|
|
||||||
linux ${kernel}
|
|
||||||
initrd ${initrd}
|
|
||||||
append ${append_live} nomodeset bee.nvidia.mode=gsp-off noapic noapm nodma nomce nolapic nosmp vga=normal net.ifnames=0 biosdevname=0
|
|
||||||
|
|
||||||
label memtest
|
|
||||||
menu label ^Memory Test (memtest86+)
|
|
||||||
linux /boot/memtest86+x64.bin
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
enforce_live_build_bootloader_assets() {
|
|
||||||
lb_dir="$1"
|
|
||||||
grub_cfg="$lb_dir/binary/boot/grub/grub.cfg"
|
|
||||||
grub_dir="$lb_dir/binary/boot/grub"
|
|
||||||
isolinux_cfg="$lb_dir/binary/isolinux/live.cfg"
|
|
||||||
|
|
||||||
if ! load_live_build_append "$lb_dir"; then
|
|
||||||
echo "bootloader sync: WARNING: could not load LB_BOOTAPPEND_LIVE from $lb_dir/config/binary" >&2
|
|
||||||
live_build_append=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$grub_cfg" ]; then
|
|
||||||
if extract_live_grub_entry "$grub_cfg"; then
|
|
||||||
mkdir -p "$grub_dir/live-theme"
|
|
||||||
cp "${BUILDER_DIR}/config/bootloaders/grub-efi/config.cfg" "$grub_dir/config.cfg"
|
|
||||||
cp "${BUILDER_DIR}/config/bootloaders/grub-efi/theme.cfg" "$grub_dir/theme.cfg"
|
|
||||||
cp -R "${BUILDER_DIR}/config/bootloaders/grub-efi/live-theme/." "$grub_dir/live-theme/"
|
|
||||||
write_canonical_grub_cfg "$grub_cfg" "$grub_kernel" "${live_build_append:-$grub_append}" "$grub_initrd"
|
|
||||||
echo "bootloader sync: rewrote binary/boot/grub/grub.cfg with canonical EASY-BEE menu"
|
|
||||||
else
|
|
||||||
echo "bootloader sync: WARNING: could not extract live entry from $grub_cfg" >&2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$isolinux_cfg" ]; then
|
|
||||||
if extract_live_isolinux_entry "$isolinux_cfg"; then
|
|
||||||
write_canonical_isolinux_cfg "$isolinux_cfg" "$isolinux_kernel" "$isolinux_initrd_path" "${live_build_append:-$isolinux_append}"
|
|
||||||
echo "bootloader sync: rewrote binary/isolinux/live.cfg with canonical EASY-BEE menu"
|
|
||||||
else
|
|
||||||
echo "bootloader sync: WARNING: could not extract live entry from $isolinux_cfg" >&2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_memtest_from_deb() {
|
copy_memtest_from_deb() {
|
||||||
deb="$1"
|
deb="$1"
|
||||||
dst_boot="$2"
|
dst_boot="$2"
|
||||||
@@ -1608,14 +1439,6 @@ run_step_sh "live-build clean" "80-lb-clean" "lb clean --all 2>&1 | tail -3"
|
|||||||
run_step_sh "live-build config" "81-lb-config" "lb config 2>&1 | tail -5"
|
run_step_sh "live-build config" "81-lb-config" "lb config 2>&1 | tail -5"
|
||||||
dump_memtest_debug "pre-build" "${LB_DIR}"
|
dump_memtest_debug "pre-build" "${LB_DIR}"
|
||||||
run_step_sh "live-build build" "90-lb-build" "lb build 2>&1"
|
run_step_sh "live-build build" "90-lb-build" "lb build 2>&1"
|
||||||
echo "=== enforcing canonical bootloader assets ==="
|
|
||||||
enforce_live_build_bootloader_assets "${LB_DIR}"
|
|
||||||
reset_live_build_stage "${LB_DIR}" "binary_checksums"
|
|
||||||
reset_live_build_stage "${LB_DIR}" "binary_iso"
|
|
||||||
reset_live_build_stage "${LB_DIR}" "binary_zsync"
|
|
||||||
run_step_sh "rebuild live-build checksums after bootloader sync" "91b-lb-checksums" "lb binary_checksums 2>&1"
|
|
||||||
run_step_sh "rebuild ISO after bootloader sync" "91c-lb-binary-iso" "lb binary_iso 2>&1"
|
|
||||||
run_step_sh "rebuild zsync after bootloader sync" "91d-lb-zsync" "lb binary_zsync 2>&1"
|
|
||||||
|
|
||||||
# --- persist deb package cache back to shared location ---
|
# --- persist deb package cache back to shared location ---
|
||||||
# This allows the second variant to reuse all downloaded packages.
|
# This allows the second variant to reuse all downloaded packages.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if loadfont $font ; then
|
if loadfont $font ; then
|
||||||
set gfxmode=1920x1080,1280x1024,auto
|
set gfxmode=1280x1024,auto
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
insmod efi_gop
|
insmod efi_gop
|
||||||
insmod efi_uga
|
insmod efi_uga
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
source /boot/grub/config.cfg
|
source /boot/grub/config.cfg
|
||||||
|
|
||||||
menuentry "EASY-BEE" {
|
menuentry "EASY-BEE" {
|
||||||
linux @KERNEL_LIVE@ @APPEND_LIVE@ bee.display=kms bee.nvidia.mode=normal pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
linux @KERNEL_LIVE@ @APPEND_LIVE@ nomodeset bee.nvidia.mode=normal pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
||||||
initrd @INITRD_LIVE@
|
initrd @INITRD_LIVE@
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "EASY-BEE -- load to RAM (toram)" {
|
menuentry "EASY-BEE -- load to RAM (toram)" {
|
||||||
linux @KERNEL_LIVE@ @APPEND_LIVE@ toram bee.display=kms bee.nvidia.mode=normal pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
linux @KERNEL_LIVE@ @APPEND_LIVE@ toram nomodeset bee.nvidia.mode=normal pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
||||||
|
initrd @INITRD_LIVE@
|
||||||
|
}
|
||||||
|
|
||||||
|
menuentry "EASY-BEE -- no GUI / no X11" {
|
||||||
|
linux @KERNEL_LIVE@ @APPEND_LIVE@ nomodeset bee.gui=off bee.nvidia.mode=gsp-off pci=realloc net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
||||||
initrd @INITRD_LIVE@
|
initrd @INITRD_LIVE@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,6 @@ title-text: ""
|
|||||||
message-font: "Unifont Regular 16"
|
message-font: "Unifont Regular 16"
|
||||||
terminal-font: "Unifont Regular 16"
|
terminal-font: "Unifont Regular 16"
|
||||||
|
|
||||||
#bee logo - centered, upper third of screen
|
|
||||||
+ image {
|
|
||||||
top = 4%
|
|
||||||
left = 50%-200
|
|
||||||
file = "bee-logo.tga"
|
|
||||||
}
|
|
||||||
|
|
||||||
#help bar at the bottom
|
#help bar at the bottom
|
||||||
+ label {
|
+ label {
|
||||||
top = 100%-50
|
top = 100%-50
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ label live-@FLAVOUR@-toram
|
|||||||
initrd @INITRD@
|
initrd @INITRD@
|
||||||
append @APPEND_LIVE@ toram nomodeset bee.nvidia.mode=normal net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
append @APPEND_LIVE@ toram nomodeset bee.nvidia.mode=normal net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
||||||
|
|
||||||
|
label live-@FLAVOUR@-console
|
||||||
|
menu label EASY-BEE (^no GUI / no X11)
|
||||||
|
linux @LINUX@
|
||||||
|
initrd @INITRD@
|
||||||
|
append @APPEND_LIVE@ nomodeset bee.gui=off bee.nvidia.mode=gsp-off net.ifnames=0 biosdevname=0 mitigations=off transparent_hugepage=always numa_balancing=disable pcie_aspm=off intel_idle.max_cstate=1 processor.max_cstate=1 nowatchdog nosoftlockup
|
||||||
|
|
||||||
label live-@FLAVOUR@-gsp-off
|
label live-@FLAVOUR@-gsp-off
|
||||||
menu label EASY-BEE (^NVIDIA GSP=off)
|
menu label EASY-BEE (^NVIDIA GSP=off)
|
||||||
linux @LINUX@
|
linux @LINUX@
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ chmod +x /usr/local/bin/bee-log-run 2>/dev/null || true
|
|||||||
chmod +x /usr/local/bin/bee-selfheal 2>/dev/null || true
|
chmod +x /usr/local/bin/bee-selfheal 2>/dev/null || true
|
||||||
chmod +x /usr/local/bin/bee-boot-status 2>/dev/null || true
|
chmod +x /usr/local/bin/bee-boot-status 2>/dev/null || true
|
||||||
chmod +x /usr/local/bin/bee-install 2>/dev/null || true
|
chmod +x /usr/local/bin/bee-install 2>/dev/null || true
|
||||||
|
chmod +x /usr/local/bin/bee-gui-gate 2>/dev/null || true
|
||||||
chmod +x /usr/local/bin/bee-remount-medium 2>/dev/null || true
|
chmod +x /usr/local/bin/bee-remount-medium 2>/dev/null || true
|
||||||
if [ "$GPU_VENDOR" = "nvidia" ]; then
|
if [ "$GPU_VENDOR" = "nvidia" ]; then
|
||||||
chmod +x /usr/local/bin/bee-nvidia-load 2>/dev/null || true
|
chmod +x /usr/local/bin/bee-nvidia-load 2>/dev/null || true
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
|
EASY BEE
|
||||||
███████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ███████╗███████╗
|
|
||||||
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝ ██╔══██╗██╔════╝██╔════╝
|
|
||||||
█████╗ ███████║███████╗ ╚████╔╝ █████╗██████╔╝█████╗ █████╗
|
|
||||||
██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ╚════╝██╔══██╗██╔══╝ ██╔══╝
|
|
||||||
███████╗██║ ██║███████║ ██║ ██████╔╝███████╗███████╗
|
|
||||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝
|
|
||||||
|
|
||||||
Hardware Audit LiveCD
|
Hardware Audit LiveCD
|
||||||
Build: %%BUILD_INFO%%
|
Build: %%BUILD_INFO%%
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Bee: hardware audit
|
Description=Bee: hardware audit
|
||||||
After=bee-preflight.service bee-network.service bee-nvidia.service bee-blackbox.service
|
After=bee-preflight.service bee-nvidia.service bee-blackbox.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Bee: bring up network interfaces via DHCP
|
Description=Bee: bring up network interfaces via DHCP
|
||||||
After=local-fs.target bee-blackbox.service
|
After=bee-web.service bee-audit.service
|
||||||
Before=network-online.target bee-audit.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Bee: runtime preflight self-check
|
Description=Bee: runtime preflight self-check
|
||||||
After=bee-network.service bee-nvidia.service bee-blackbox.service
|
After=bee-nvidia.service bee-blackbox.service
|
||||||
Before=bee-audit.service
|
Before=bee-audit.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[Service]
|
||||||
|
ExecCondition=/usr/local/bin/bee-gui-gate
|
||||||
@@ -51,12 +51,7 @@ while true; do
|
|||||||
printf '\033[H\033[2J'
|
printf '\033[H\033[2J'
|
||||||
|
|
||||||
printf '\n'
|
printf '\n'
|
||||||
printf ' \033[33m███████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ███████╗███████╗\033[0m\n'
|
printf ' \033[33mEASY BEE\033[0m\n'
|
||||||
printf ' \033[33m██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝ ██╔══██╗██╔════╝██╔════╝\033[0m\n'
|
|
||||||
printf ' \033[33m█████╗ ███████║███████╗ ╚████╔╝ █████╗██████╔╝█████╗ █████╗\033[0m\n'
|
|
||||||
printf ' \033[33m██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ╚════╝██╔══██╗██╔══╝ ██╔══╝\033[0m\n'
|
|
||||||
printf ' \033[33m███████╗██║ ██║███████║ ██║ ██████╔╝███████╗███████╗\033[0m\n'
|
|
||||||
printf ' \033[33m╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝\033[0m\n'
|
|
||||||
printf ' Hardware Audit LiveCD\n'
|
printf ' Hardware Audit LiveCD\n'
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
|
|||||||
27
iso/overlay/usr/local/bin/bee-gui-gate
Executable file
27
iso/overlay/usr/local/bin/bee-gui-gate
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# bee-gui-gate — skip starting the local GUI when bee.gui=off is set.
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
cmdline_param() {
|
||||||
|
key="$1"
|
||||||
|
for token in $(cat /proc/cmdline 2>/dev/null); do
|
||||||
|
case "$token" in
|
||||||
|
"$key"=*)
|
||||||
|
echo "${token#*=}"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
mode="$(cmdline_param bee.gui || true)"
|
||||||
|
case "${mode}" in
|
||||||
|
off|false|0|tty|console|text|nogui)
|
||||||
|
echo "bee-gui-gate: bee.gui=${mode}; skipping lightdm"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# bee-network.sh — bring up all physical network interfaces via DHCP
|
# bee-network.sh — bring up all physical network interfaces via DHCP
|
||||||
# Unattended: runs silently, logs results, never blocks.
|
# Unattended: starts later in boot, runs quietly, and gives up after a bounded timeout.
|
||||||
|
|
||||||
LOG_PREFIX="bee-network"
|
LOG_PREFIX="bee-network"
|
||||||
|
DHCP_TIMEOUT_SECS=300
|
||||||
|
|
||||||
log() { echo "[$LOG_PREFIX] $*"; }
|
log() { echo "[$LOG_PREFIX] $*"; }
|
||||||
|
|
||||||
@@ -19,9 +20,50 @@ if command -v udevadm >/dev/null 2>&1; then
|
|||||||
udevadm settle --timeout=5 >/dev/null 2>&1 || log "WARN: udevadm settle timed out"
|
udevadm settle --timeout=5 >/dev/null 2>&1 || log "WARN: udevadm settle timed out"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
start_dhcp() {
|
||||||
|
iface="$1"
|
||||||
|
if ! ip link set "$iface" up; then
|
||||||
|
log "WARN: could not bring up $iface"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
carrier=$(cat "/sys/class/net/$iface/carrier" 2>/dev/null || true)
|
||||||
|
if [ "$carrier" = "1" ]; then
|
||||||
|
log "carrier detected on $iface"
|
||||||
|
else
|
||||||
|
log "carrier not detected on $iface"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dhclient -r "$iface" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
if timeout "${DHCP_TIMEOUT_SECS}" dhclient -4 -q -1 "$iface" >/dev/null 2>&1; then
|
||||||
|
addr="$(ip -4 -o addr show dev "$iface" scope global 2>/dev/null | awk '{print $4}' | head -1)"
|
||||||
|
if [ -n "$addr" ]; then
|
||||||
|
log "DHCP lease acquired on $iface ($addr)"
|
||||||
|
else
|
||||||
|
log "DHCP lease acquired on $iface"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
rc=$?
|
||||||
|
case "$rc" in
|
||||||
|
124)
|
||||||
|
log "DHCP timed out on $iface after ${DHCP_TIMEOUT_SECS}s"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log "DHCP failed on $iface (exit $rc)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
dhclient -r "$iface" >/dev/null 2>&1 || true
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
started_ifaces=""
|
started_ifaces=""
|
||||||
started_count=0
|
started_count=0
|
||||||
scan_pass=1
|
scan_pass=1
|
||||||
|
pids=""
|
||||||
|
pid_ifaces=""
|
||||||
|
|
||||||
# Some server NICs appear a bit later after module/firmware init. Do a small
|
# Some server NICs appear a bit later after module/firmware init. Do a small
|
||||||
# bounded rescan window without turning network bring-up into a boot blocker.
|
# bounded rescan window without turning network bring-up into a boot blocker.
|
||||||
@@ -34,22 +76,11 @@ while [ "$scan_pass" -le 3 ]; do
|
|||||||
*" $iface "*) continue ;;
|
*" $iface "*) continue ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
log "bringing up $iface"
|
log "starting DHCP on $iface (timeout ${DHCP_TIMEOUT_SECS}s)"
|
||||||
if ! ip link set "$iface" up; then
|
start_dhcp "$iface" &
|
||||||
log "WARN: could not bring up $iface"
|
pid="$!"
|
||||||
continue
|
pids="$pids $pid"
|
||||||
fi
|
pid_ifaces="$pid_ifaces $pid:$iface"
|
||||||
|
|
||||||
carrier=$(cat "/sys/class/net/$iface/carrier" 2>/dev/null || true)
|
|
||||||
if [ "$carrier" = "1" ]; then
|
|
||||||
log "carrier detected on $iface"
|
|
||||||
else
|
|
||||||
log "carrier not detected yet on $iface"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# DHCP in background — non-blocking, keep dhclient verbose output in the service log.
|
|
||||||
dhclient -4 -v -nw "$iface" &
|
|
||||||
log "DHCP started for $iface (pid $!)"
|
|
||||||
|
|
||||||
started_ifaces="$started_ifaces $iface"
|
started_ifaces="$started_ifaces $iface"
|
||||||
started_count=$((started_count + 1))
|
started_count=$((started_count + 1))
|
||||||
@@ -68,4 +99,15 @@ if [ "$started_count" -eq 0 ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "done (interfaces started: $started_count)"
|
success_count=0
|
||||||
|
for pid_iface in $pid_ifaces; do
|
||||||
|
pid="${pid_iface%%:*}"
|
||||||
|
iface="${pid_iface#*:}"
|
||||||
|
if wait "$pid"; then
|
||||||
|
success_count=$((success_count + 1))
|
||||||
|
else
|
||||||
|
log "DHCP did not complete successfully on $iface"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
log "done (interfaces scanned: $started_count, leases acquired: $success_count)"
|
||||||
|
|||||||
Reference in New Issue
Block a user