housekeeping & ocd
All checks were successful
Update Dispatches / refresh-news (push) Successful in 1s

This commit is contained in:
2026-02-08 02:57:13 -05:00
parent b0b0d05206
commit 92a01dee96

View File

@@ -5,7 +5,6 @@
BLUE='\033[38;5;45m'; PURPLE='\033[38;5;127m'; GOLD='\033[38;5;178m'; RED='\033[38;5;196m'; NC='\033[0m'
HOST_FILE="$HOME/.dynr/.pve_hosts"; mkdir -p "$HOME/.dynr"
# --- 1. UNIVERSAL INPUT & AUTH ---
get_input() {
local p=$1; local h=$2
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -17,9 +16,7 @@ get_input() {
}
if ! command -v pct &> /dev/null; then
# Scrub ghost entries
[[ -f "$HOST_FILE" ]] && sed -i '/^$/d' "$HOST_FILE"
[[ ! -s "$HOST_FILE" ]] && HP="n" || {
echo -e "${PURPLE}🐉 Your Proxmox VE Hosts:${NC}"
cat -n "$HOST_FILE" | awk -F'|' '{print $1") " $2 " (" $5 ")"}'
@@ -37,11 +34,11 @@ if ! command -v pct &> /dev/null; then
fi
case ${MA:0:1} in
1) if [[ "$OSTYPE" == "darwin"* ]]; then
PK=$(osascript -e "set theList to every paragraph of \"$(cat "$HOST_FILE" | awk -F'|' '{print $2 " (" $5 ")"}')\"" -e 'choose from list theList with multiple selections allowed')
[[ "$PK" != "false" ]] && IFS=',' read -ra ADDR <<< "$PK" && for p in "${ADDR[@]}"; do sed -i '' "/${p%% *}/d" "$HOST_FILE"; done
PK=$(osascript -e "set theList to every paragraph of \"$(cat "$HOST_FILE" | awk -F'|' '{print $2 " (" $5 ")"}')\"" -e 'choose from list theList with title "Purge" with prompt "Cmd+Click to select multiple hosts:" with multiple selections allowed')
[[ "$PK" != "false" ]] && IFS=',' read -ra ADDR <<< "$PK" && for p in "${ADDR[@]}"; do target=$(echo "$p" | xargs); sed -i '' "/${target%% *}/d" "$HOST_FILE"; done
else
WL=$(cat -n "$HOST_FILE" | awk -F'|' '{print $1 " " $5 " off"}')
REMS=$(whiptail --title "Purge Hosts" --checklist "Select to remove" 20 60 10 $WL 3>&1 1>&2 2>&3)
REMS=$(whiptail --title "Purge" --checklist "Use Spacebar to select multiple targets:" 20 60 10 $WL 3>&1 1>&2 2>&3)
[[ -n "$REMS" ]] && for id in ${REMS//\"/}; do sed -i "${id}d" "$HOST_FILE"; done
fi ;;
2) read -p "Line # to edit: " E_ID < /dev/tty
@@ -93,7 +90,7 @@ while true; do
[[ "$SN" == "1" ]] && S="portainer"; [[ "$SN" == "2" ]] && S="arcane"; [[ "$SN" == "3" ]] && S="dockhand"
$REMOTE "pct create $CID $TS:vztmpl/$T --hostname $NM --storage $DS --rootfs $DS:$DSZ --net0 name=eth0,bridge=vmbr0,ip=dhcp --protection 1 --unprivileged $PR"
$REMOTE "pct start $CID && sleep 8"; LIP=$($REMOTE "pct exec $CID -- ip -4 addr show eth0" | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
$REMOTE "pct exec $CID -- bash -c \"\$(curl -sSL https://git.dynastyrevolution.com/DYNR/scripts/raw/branch/v2.3.7-pre/bootstrap.sh) $S n\""
$REMOTE "pct exec $CID -- bash -c \"\$(curl -sSL https://git.dynastyrevolution.com/DYNR/scripts/raw/branch/main/bootstrap.sh) $S n\""
RP+="${PURPLE}---${NC}\n$NM ($CID): $LIP\n"; [[ "$S" == "portainer" ]] && RP+="URL: https://$LIP:9443\n"; [[ "$S" == "arcane" ]] && RP+="URL: http://$LIP:8080\n"; done
echo -e "${BLUE}🚀 Complete!${NC}\n$RP"; read -p "Enter..." ;;
2) $REMOTE "pct list" | awk 'NR>1 {printf " 🐉 [%s] ID: %-5s Name: %-15s\n", $3, $1, $2}'; read -p "ID (q): " TID < /dev/tty
@@ -102,15 +99,15 @@ while true; do
CMD=""
[[ "$CG" == "1" ]] && CMD="$REMOTE"
[[ "$CG" == "2" ]] && { LD=$($REMOTE "pct list | awk 'NR>1 {print \$1 \"-\" \$2}'")
if [[ "$OSTYPE" == "darwin"* ]]; then TID_R=$(osascript -e "set theList to every paragraph of \"$LD\"" -e 'choose from list theList'); TID=$(echo "$TID_R" | cut -d'-' -f1); else
if [[ "$OSTYPE" == "darwin"* ]]; then TID_R=$(osascript -e "set theList to every paragraph of \"$LD\"" -e 'choose from list theList with prompt "Select LXC Console:"); TID=$(echo "$TID_R" | cut -d'-' -f1); else
WL=$(echo "$LD" | awk -F'-' '{print $1 \" \" $2}'); TID=$(whiptail --menu "Console" 20 60 10 $WL 3>&1 1>&2 2>&3); fi
[[ -n "$TID" && "$TID" != "false" ]] && CMD="$REMOTE \"pct enter $TID\""; }
if [[ -n "$CMD" ]]; then
[[ "$OSTYPE" == "darwin"* ]] && osascript -e "tell application \"Terminal\" to do script \"$CMD\"" || eval $CMD
fi ;;
4) echo -e "${PURPLE}📡 Gathering...${NC}"; LD=$($REMOTE "pct list | awk 'NR>1 {print \$1 \" \" \$2 \" \" \$3}'")
if [[ "$OSTYPE" == "darwin"* ]]; then PK=$(osascript -e "set theList to every paragraph of \"$LD\"" -e 'choose from list theList with multiple selections allowed'); TG=$(echo "$PK" | awk '{print $1}'); else
WL=$(echo "$LD" | awk '{print $1 \" \" $2 \" off\"}'); TG=$(whiptail --checklist "Select" 20 60 10 $WL 3>&1 1>&2 2>&3); fi
if [[ "$OSTYPE" == "darwin"* ]]; then PK=$(osascript -e "set theList to every paragraph of \"$LD\"" -e 'choose from list theList with title "Fleet Update" with prompt "Cmd+Click to select multiple targets:" with multiple selections allowed'); TG=$(echo "$PK" | awk '{print $1}'); else
WL=$(echo "$LD" | awk '{print $1 \" \" $2 \" off\"}'); TG=$(whiptail --checklist "Use Spacebar to select multiple targets:" 20 60 10 $WL 3>&1 1>&2 2>&3); fi
for RCID in ${TG//\"/}; do echo -e "${BLUE}Updating $RCID...${NC}"; $REMOTE "pct exec $RCID -- apt-get update && apt-get upgrade -y"; done; read -p "Done..." ;;
5) echo -e "${GOLD}Returning to Dynasty Front Gate...${NC}"; sleep 1; break ;;
esac