Compare commits
8 Commits
fce70b05da
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
6b73b5c79a
|
|||
|
94d2c711ce
|
|||
|
|
7770e09feb | ||
|
5545ccaf1f
|
|||
| d82a96eccb | |||
| 133b6fb281 | |||
|
ee69659a82
|
|||
|
5b8120eb27
|
16
README.md
16
README.md
@@ -11,37 +11,37 @@ Run on Linux/macOS using curl:
|
|||||||
### enable_wol_proxmox.sh
|
### enable_wol_proxmox.sh
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o enable_wol_proxmox.sh "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/enable_wol_proxmox.sh" && chmod +x enable_wol_proxmox.sh && ./"enable_wol_proxmox.sh"
|
curl -fsSL -o enable_wol_proxmox.sh "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/enable_wol_proxmox.sh" && chmod +x enable_wol_proxmox.sh && ./"enable_wol_proxmox.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
### fakepve.sh
|
### fakepve.sh
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o fakepve.sh "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/fakepve.sh" && chmod +x fakepve.sh && ./"fakepve.sh"
|
curl -fsSL -o fakepve.sh "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/fakepve.sh" && chmod +x fakepve.sh && ./"fakepve.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
### list_root_domains.sh
|
### list_root_domains.sh
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o list_root_domains.sh "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/list_root_domains.sh" && chmod +x list_root_domains.sh && ./"list_root_domains.sh"
|
curl -fsSL -o list_root_domains.sh "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/list_root_domains.sh" && chmod +x list_root_domains.sh && ./"list_root_domains.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
### selfsigned_certs.sh
|
### selfsigned_certs.sh
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o selfsigned_certs.sh "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/selfsigned_certs.sh" && chmod +x selfsigned_certs.sh && ./"selfsigned_certs.sh"
|
curl -fsSL -o selfsigned_certs.sh "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/selfsigned_certs.sh" && chmod +x selfsigned_certs.sh && ./"selfsigned_certs.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
### setup-nut-slave.sh
|
### setup-nut-slave.sh
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o setup-nut-slave.sh "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/setup-nut-slave.sh" && chmod +x setup-nut-slave.sh && ./"setup-nut-slave.sh"
|
curl -fsSL -o setup-nut-slave.sh "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/setup-nut-slave.sh" && chmod +x setup-nut-slave.sh && ./"setup-nut-slave.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
### setup_deploy_user.sh
|
### setup_deploy_user.sh
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL -o setup_deploy_user.sh "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/setup_deploy_user.sh" && chmod +x setup_deploy_user.sh && ./"setup_deploy_user.sh"
|
curl -fsSL -o setup_deploy_user.sh "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/setup_deploy_user.sh" && chmod +x setup_deploy_user.sh && ./"setup_deploy_user.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Windows (.bat)
|
## Windows (.bat)
|
||||||
@@ -52,10 +52,10 @@ Run from PowerShell:
|
|||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
$dest = Join-Path $env:TEMP "win-mao.bat";
|
$dest = Join-Path $env:TEMP "win-mao.bat";
|
||||||
Invoke-WebRequest -Uri "ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools/raw/branch/main/win-mao.bat" -OutFile $dest;
|
Invoke-WebRequest -Uri "https://git.hudsonriggs.systems/HRiggs/Tools/raw/branch/main/win-mao.bat" -OutFile $dest;
|
||||||
& $dest
|
& $dest
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Generated from repo: `ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools` on branch `main`.
|
Generated from repo: `https://git.hudsonriggs.systems/HRiggs/Tools` on branch `main`.
|
||||||
|
|||||||
@@ -21,6 +21,47 @@ info() {
|
|||||||
echo "[*] $*"
|
echo "[*] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Return 0 if interface is physical (non-virtual)
|
||||||
|
is_physical_iface() {
|
||||||
|
local iface="$1"
|
||||||
|
local dev_path
|
||||||
|
dev_path=$(readlink -f "/sys/class/net/${iface}/device" 2>/dev/null || true)
|
||||||
|
[[ -n "$dev_path" && "$dev_path" != *"/virtual/"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Resolve bridge/bond to the underlying physical NIC, if possible
|
||||||
|
resolve_physical_iface() {
|
||||||
|
local iface="$1"
|
||||||
|
local candidate resolved
|
||||||
|
|
||||||
|
# If iface is a bridge, iterate its members
|
||||||
|
if [[ -d "/sys/class/net/${iface}/bridge" ]]; then
|
||||||
|
for brif in /sys/class/net/${iface}/brif/*; do
|
||||||
|
[[ -e "$brif" ]] || continue
|
||||||
|
candidate=$(basename "$brif")
|
||||||
|
resolved=$(resolve_physical_iface "$candidate")
|
||||||
|
[[ -n "$resolved" ]] && echo "$resolved" && return
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If iface is a bond, walk its slaves
|
||||||
|
if [[ -f "/sys/class/net/${iface}/bonding/slaves" ]]; then
|
||||||
|
for slave in $(<"/sys/class/net/${iface}/bonding/slaves"); do
|
||||||
|
resolved=$(resolve_physical_iface "$slave")
|
||||||
|
[[ -n "$resolved" ]] && echo "$resolved" && return
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If iface itself is physical, return it
|
||||||
|
if is_physical_iface "$iface"; then
|
||||||
|
echo "$iface"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback: return original iface even if virtual
|
||||||
|
echo "$iface"
|
||||||
|
}
|
||||||
|
|
||||||
# --- Preconditions -----------------------------------------------------------
|
# --- Preconditions -----------------------------------------------------------
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
@@ -66,6 +107,14 @@ fi
|
|||||||
|
|
||||||
info "Detected primary interface: ${PRIMARY_IF}"
|
info "Detected primary interface: ${PRIMARY_IF}"
|
||||||
|
|
||||||
|
PHYSICAL_IF=$(resolve_physical_iface "$PRIMARY_IF")
|
||||||
|
if [[ "$PHYSICAL_IF" != "$PRIMARY_IF" ]]; then
|
||||||
|
info "Resolved underlying physical interface: ${PHYSICAL_IF}"
|
||||||
|
PRIMARY_IF="$PHYSICAL_IF"
|
||||||
|
else
|
||||||
|
info "Using ${PRIMARY_IF} as the primary physical interface."
|
||||||
|
fi
|
||||||
|
|
||||||
# --- Get MAC address & IP ----------------------------------------------------
|
# --- Get MAC address & IP ----------------------------------------------------
|
||||||
|
|
||||||
MAC_ADDR=$(ip -o link show "$PRIMARY_IF" | awk '{for (i=1; i<=NF; i++) if ($i=="link/ether") print $(i+1)}')
|
MAC_ADDR=$(ip -o link show "$PRIMARY_IF" | awk '{for (i=1; i<=NF; i++) if ($i=="link/ether") print $(i+1)}')
|
||||||
@@ -144,10 +193,10 @@ fi
|
|||||||
info "Verifying WOL is enabled on ${PRIMARY_IF}..."
|
info "Verifying WOL is enabled on ${PRIMARY_IF}..."
|
||||||
|
|
||||||
VERIFY_OUTPUT=$(ethtool "$PRIMARY_IF")
|
VERIFY_OUTPUT=$(ethtool "$PRIMARY_IF")
|
||||||
WAKE_ON=$(awk -F: '/Wake-on/ {gsub(/ /,"",$2); print $2}' <<<"$VERIFY_OUTPUT")
|
WAKE_ON=$(awk -F: '$1 ~ /^[[:space:]]*Wake-on$/ {gsub(/ /,"",$2); print $2; exit}' <<<"$VERIFY_OUTPUT")
|
||||||
|
|
||||||
if [[ "$WAKE_ON" != "g" ]]; then
|
if [[ "$WAKE_ON" != *g* ]]; then
|
||||||
err "WOL verification failed: Wake-on is '${WAKE_ON}', expected 'g'. Check BIOS settings and /etc/network/interfaces."
|
err "WOL verification failed: Wake-on is '${WAKE_ON}', expected to include 'g'. Check BIOS settings and /etc/network/interfaces."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "WOL verification succeeded: Wake-on is '${WAKE_ON}'."
|
info "WOL verification succeeded: Wake-on is '${WAKE_ON}'."
|
||||||
|
|||||||
@@ -5,27 +5,8 @@ set -euo pipefail
|
|||||||
# This file is intended to be run in CI and locally.
|
# This file is intended to be run in CI and locally.
|
||||||
|
|
||||||
determine_repo_web_base() {
|
determine_repo_web_base() {
|
||||||
local origin_url
|
# Use hardcoded base URL
|
||||||
origin_url="$(git config --get remote.origin.url || true)"
|
printf '%s' "https://git.hudsonriggs.systems/HRiggs/Tools"
|
||||||
if [[ -z "${origin_url}" ]]; then
|
|
||||||
echo "Error: could not determine git remote origin URL" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local web_base
|
|
||||||
if [[ "${origin_url}" =~ ^https?:// ]]; then
|
|
||||||
web_base="${origin_url%.git}"
|
|
||||||
elif [[ "${origin_url}" =~ ^git@([^:]+):(.+)\.git$ ]]; then
|
|
||||||
local host path
|
|
||||||
host="${BASH_REMATCH[1]}"
|
|
||||||
path="${BASH_REMATCH[2]}"
|
|
||||||
web_base="https://${host}/${path}"
|
|
||||||
else
|
|
||||||
# Fallback: strip trailing .git if present
|
|
||||||
web_base="${origin_url%.git}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf '%s' "${web_base}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
determine_branch() {
|
determine_branch() {
|
||||||
|
|||||||
Reference in New Issue
Block a user