All checks were successful
Update Dispatches / refresh-news (push) Successful in 1s
85 lines
5.2 KiB
Bash
85 lines
5.2 KiB
Bash
#!/bin/bash
|
|
# -----------------------------------------------------------------------
|
|
# Dynasty Revolution Universal Installer v2.3.7-pre (Smart-Sync Edition)
|
|
# -----------------------------------------------------------------------
|
|
|
|
# --- 1. ENVIRONMENT & STYLING ---
|
|
[[ "$OSTYPE" == "darwin"* ]] && { OS="macOS"; DP="$HOME/.dynr"; } || { OS="Linux"; DP="/opt/dynr"; }
|
|
VERSION="2.3.7-pre"
|
|
REPO="https://git.dynastyrevolution.com/DYNR/DynastyRevolution-Scripts/raw/branch/v2.3.7-pre"
|
|
BLUE='\033[38;5;45m'; PURPLE='\033[38;5;127m'; GOLD='\033[38;5;178m'; RED='\033[38;5;196m'; NC='\033[0m'
|
|
|
|
# --- 2. INITIAL MANIFEST (BOOTSTRAP) ---
|
|
if [ ! -f "/usr/local/bin/dynr" ]; then
|
|
clear; echo -e "${BLUE}🐉 Dynasty Revolution Systems Initializing...${NC}"
|
|
read -p "📥 Manifest Framework? (y/n): " CF < /dev/tty
|
|
if [[ "$CF" =~ ^[Yy]$ ]]; then
|
|
[[ "$OS" == "macOS" ]] && mkdir -p "$DP/modules" || sudo mkdir -p "$DP/modules"
|
|
sudo curl -sSL "$REPO/install.sh" -o /usr/local/bin/dynr && sudo chmod +x /usr/local/bin/dynr
|
|
echo -e "${GOLD}✅ System Manifested! Type 'dynr' to begin.${NC}"
|
|
fi; exit 0
|
|
fi
|
|
|
|
# --- 3. MAIN INTERFACE LOOP ---
|
|
while true; do
|
|
clear
|
|
echo -e "${BLUE}🐉 Dynasty Revolution Systems | v$VERSION${NC}"
|
|
echo -e "${PURPLE}📡 Pulse Check:${NC}"
|
|
echo -e " [${GOLD}OK${NC}] OS: $OS ($(uname -m))"
|
|
ping -c 1 1.1.1.1 &>/dev/null && echo -e " [${GOLD}OK${NC}] Network: Cloudflare Reachable" || echo -e " [${RED}!!${NC}] Network: Offline"
|
|
|
|
echo -e "${PURPLE}-------------------------------------------------${NC}"
|
|
echo -e "${GOLD}📜 LATEST ARCHIVE DISPATCHES:${NC}"
|
|
curl -sL --connect-timeout 1 "$REPO/dispatches.txt" | sed "s/^/ /"
|
|
echo -e "${PURPLE}-------------------------------------------------${NC}"
|
|
|
|
echo -e "1) ${BLUE}Quick Strike${NC} (Modules)\n2) ${GOLD}Proxmox Commander${NC}\n3) ${PURPLE}Remove Modules${NC} (Multi-Select)\n4) ${BLUE}Update & Sync${NC}\n5) ${RED}Uninstall${NC}\n6) Exit"
|
|
read -p "Selection [1-6]: " OPT < /dev/tty
|
|
|
|
case $OPT in
|
|
1) # MODULE LOADER
|
|
echo -e "\n${PURPLE}📜 Local Scrolls:${NC}"
|
|
ls "$DP/modules" 2>/dev/null | sed 's/^/ ↓ /'
|
|
read -p "dynr > " CMD < /dev/tty
|
|
if [[ -n "$CMD" && "$CMD" != "exit" ]]; then
|
|
[[ ! -f "$DP/modules/$CMD" ]] && { curl -s -o "$DP/modules/$CMD" "$REPO/modules/$CMD"; chmod +x "$DP/modules/$CMD"; }
|
|
"$DP/modules/$CMD" < /dev/tty; read -p "Press Enter to return..." < /dev/tty
|
|
fi ;;
|
|
2) # PROXMOX COMMANDER
|
|
[[ ! -f "$DP/modules/proxmox-commander" ]] && { echo -e "${GOLD}🔎 Fetching Commander...${NC}"; curl -s -o "$DP/modules/proxmox-commander" "$REPO/modules/proxmox-commander"; chmod +x "$DP/modules/proxmox-commander"; }
|
|
"$DP/modules/proxmox-commander" < /dev/tty
|
|
echo -e "\n${BLUE}Back at the Front Gate.${NC}"
|
|
read -p "Press Enter to continue..." < /dev/tty ;;
|
|
3) # SMART MULTI-REMOVE
|
|
MODS=$(ls "$DP/modules" 2>/dev/null)
|
|
if [[ -z "$MODS" ]]; then echo -e "${RED}No modules found.${NC}"; sleep 1; continue; fi
|
|
if [[ "$OS" == "macOS" ]]; then
|
|
PK=$(osascript -e "set theList to every paragraph of \"$MODS\"" -e 'choose from list theList with title "Module Purge" with prompt "Select modules to delete (Cmd+Click for multiple):" with multiple selections allowed')
|
|
[[ "$PK" == "false" ]] && continue
|
|
IFS=',' read -ra ADDR <<< "$PK"
|
|
for m in "${ADDR[@]}"; do target=$(echo "$m" | xargs); rm -f "$DP/modules/$target"; echo -e "${GOLD} ❌ Removed: $target${NC}"; done
|
|
else
|
|
WL=$(echo "$MODS" | awk '{print $1 " " $1 " off"}')
|
|
REMS=$(whiptail --title "Module Purge" --checklist "Use Spacebar to select targets:" 20 60 10 $WL 3>&1 1>&2 2>&3)
|
|
[[ -n "$REMS" ]] && for id in ${REMS//\"/}; do rm -f "$DP/modules/$id"; echo -e "${GOLD} ❌ Removed: $id${NC}"; done
|
|
fi; sleep 1 ;;
|
|
4) # SMART UPDATE & SYNC
|
|
echo -e "${GOLD}🔄 Syncing Framework...${NC}"
|
|
sudo curl -sSL "$REPO/install.sh" -o /usr/local/bin/dynr && sudo chmod +x /usr/local/bin/dynr
|
|
if [ -d "$DP/modules" ]; then
|
|
for mod in "$DP/modules"/*; do
|
|
[ -e "$mod" ] || continue
|
|
m_name=$(basename "$mod")
|
|
echo -ne "${PURPLE} -> Refreshing $m_name... ${NC}"
|
|
curl -s -o "$mod" "$REPO/modules/$m_name" && chmod +x "$mod" && echo -e "${GOLD}DONE${NC}"
|
|
done
|
|
fi; echo -e "${BLUE}✅ Sync Complete.${NC}"; sleep 1; exec /usr/local/bin/dynr ;;
|
|
5) # UNINSTALL
|
|
read -p "⚠️ Uninstall? (y/n): " UN < /dev/tty
|
|
[[ "$UN" == "y" ]] && { sudo rm -f /usr/local/bin/dynr; rm -rf "$DP"; exit 0; } ;;
|
|
6) # EXIT
|
|
echo -e "${GOLD}\n ____ __ __ _ _ ____ \n | _ \ \ \ / /| \ | || _ \ \n | | | | \ V / | \| || |_) |\n | |_| | | | | |\ || _ < \n |____/ |_| |_| \_||_| \_\\\\${NC}"
|
|
echo -e "${BLUE} 🐉 DEPARTING THE DYNASTY...${NC}\n"; exit 0 ;;
|
|
*) echo "Invalid selection."; sleep 1 ;;
|
|
esac
|
|
done |