Compare commits

...

6 Commits

Author SHA1 Message Date
6b73b5c79a update wol
All checks were successful
Generate README / build (push) Successful in 7s
2025-12-02 23:36:00 -05:00
94d2c711ce push wol
All checks were successful
Generate README / build (push) Successful in 7s
2025-12-02 23:33:44 -05:00
gitea-bot
7770e09feb docs: auto-generate README for scripts [skip ci] 2025-12-03 04:23:14 +00:00
5545ccaf1f fugma
All checks were successful
Generate README / build (push) Successful in 8s
2025-12-02 23:22:41 -05:00
d82a96eccb revert ee69659a82
revert Merge branch 'main' of https://git.hudsonriggs.systems/HRiggs/tools
2025-12-03 04:22:05 +00:00
133b6fb281 revert 5b8120eb27
All checks were successful
Generate README / build (push) Successful in 8s
revert fix remote url
2025-12-03 04:21:50 +00:00
4 changed files with 81 additions and 35 deletions

View File

@@ -21,9 +21,25 @@ jobs:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
- name: Setup Git remote - name: Setup SSH with deploy key
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: | run: |
git remote set-url origin https://git.hudsonriggs.systems/HRiggs/tools.git mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-keyscan -p 22113 -H git.hudsonriggs.systems >> ~/.ssh/known_hosts
{
echo "Host git.hudsonriggs.systems";
echo " HostName git.hudsonriggs.systems";
echo " Port 22113";
echo " User git";
} >> ~/.ssh/config
chmod 600 ~/.ssh/config
git remote set-url origin ssh://git@git.hudsonriggs.systems:22113/HRiggs/tools.git
- name: Generate README - name: Generate README
run: | run: |
@@ -44,7 +60,7 @@ jobs:
env: env:
BRANCH_NAME: ${{ github.ref_name }} BRANCH_NAME: ${{ github.ref_name }}
run: | run: |
: "Pushing to branch ${BRANCH_NAME} via HTTPS" : "Pushing to branch ${BRANCH_NAME} via SSH"
git push origin HEAD:"${BRANCH_NAME}" git push origin HEAD:"${BRANCH_NAME}"

View File

@@ -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`.

View File

@@ -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}'."

View File

@@ -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() {