adjust macos support
This commit is contained in:
@@ -5,7 +5,7 @@ variables() {
|
||||
var_install="${NSAPP}-install"
|
||||
INTEGER='^[0-9]+([.][0-9]+)?$'
|
||||
PVEHOST_NAME=$(hostname)
|
||||
METHOD="default"
|
||||
METHOD="${METHOD:-default}"
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
RANDOM_UUID="$(uuidgen | tr '[:upper:]' '[:lower:]')"
|
||||
@@ -81,7 +81,7 @@ network_check() {
|
||||
}
|
||||
|
||||
github_api_check() {
|
||||
msg_info "Querying Archive AP..."
|
||||
msg_info "Checking Github API Token..."
|
||||
local api_response=$(curl -s https://api.github.com/rate_limit)
|
||||
local remaining=$(echo "$api_response" | grep -A 2 '"core"' | grep '"remaining"' | tr -dc '0-9')
|
||||
if [[ -n "$remaining" ]]; then
|
||||
@@ -96,7 +96,7 @@ check_manifest_updates() {
|
||||
local remote_ver=$(curl -fsSL --connect-timeout 2 "$remote_script" | grep -m 1 "VERSION=" | cut -d'"' -f2 || echo "0")
|
||||
|
||||
if [[ "$remote_ver" > "$VERSION" ]]; then
|
||||
msg_warn "A New update has Dawned: v$remote_ver is available in the Archives."
|
||||
msg_warn "A New update has Dawned: v$remote_ver is available."
|
||||
msg_info "Current Version: v$VERSION"
|
||||
echo -e "${GOLD}Recommendation: Re-sync with latest version.${NC}"
|
||||
echo ""
|
||||
@@ -130,19 +130,25 @@ initiate_remote_strike() {
|
||||
exit_script
|
||||
fi
|
||||
|
||||
local deploy_mode=$(remote_strike_ui "Deployment Mode (Type 'advanced' or 'default'):" "advanced")
|
||||
if [[ -z "$deploy_mode" ]]; then
|
||||
deploy_mode="default"
|
||||
fi
|
||||
|
||||
local script_home="${DYNR_REPO}/${MODULE_PATH}"
|
||||
|
||||
clear
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e " ${GOLD}INITIATING REMOTE PROVISIONING${NC}"
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e " ${GOLD}INITIATING REMOTE PROVISIONING${NC}"
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${BLUE}Target Host: ${NC} $target_host"
|
||||
echo -e "${BLUE}User: ${NC} $target_user"
|
||||
echo -e "${BLUE}Script URL: ${NC} $script_home"
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${BLUE}Mode: ${NC} $deploy_mode"
|
||||
echo -e "${BLUE}Script: ${GOLD}${APP}${NC}"
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo ""
|
||||
|
||||
if ssh -t "${target_user}@${target_host}" "bash -c 'curl -fsSL $script_home | bash'"; then
|
||||
if ssh -t "${target_user}@${target_host}" "METHOD=\"$deploy_mode\" bash -c \"\$(curl -fsSL $script_home)\""; then
|
||||
msg_ok "Provision Successful."
|
||||
else
|
||||
msg_error "Provision Failure. Check logs at: ${INSTALL_LOG}"
|
||||
@@ -235,7 +241,7 @@ advanced_settings() {
|
||||
local MAX_STEP=13
|
||||
while [[ $STEP -le $MAX_STEP ]]; do
|
||||
case $STEP in
|
||||
1) if result=$(whiptail --backtitle "Dynasty OS" --title "STANCE" --radiolist "Select Container Type:" 12 58 2 "1" "Tactical (Unprivileged)" ON "0" "Imperial (Privileged)" OFF 3>&1 1>&2 2>&3); then CT_TYPE="$result"; STEP=$((STEP + 1)); else exit_script; fi ;;
|
||||
1) if result=$(whiptail --backtitle "Dynasty OS" --title "STANCE" --radiolist "Select Container Type:" 12 58 2 "1" "Tactical (Unprivileged)" ON "0" "LXC (Privileged)" OFF 3>&1 1>&2 2>&3); then CT_TYPE="$result"; STEP=$((STEP + 1)); else exit_script; fi ;;
|
||||
2) if result=$(whiptail --backtitle "Dynasty OS" --title "ERA SELECTION" --radiolist "Select OS Base:" 12 58 3 "debian" "Debian 12" ON "alpine" "Alpine 3.20" OFF "ubuntu" "Ubuntu 24.04" OFF 3>&1 1>&2 2>&3); then OS_CHOICE="$result"; STEP=$((STEP + 1)); else STEP=$((STEP - 1)); fi ;;
|
||||
3) if result=$(whiptail --backtitle "Dynasty OS" --title "AUTHORITY" --passwordbox "Establish Root Password (Blank for Auto-Auth):" 12 58 3>&1 1>&2 2>&3); then if [[ -n "$result" ]]; then PW="--password $result"; else PW=""; fi; STEP=$((STEP + 1)); else STEP=$((STEP - 1)); fi ;;
|
||||
4) if whiptail --backtitle "Dynasty OS" --title "VPN CAPABILITY" --yesno "Enable TUN/TAP (/dev/net/tun) for VPN interfaces?" 10 58; then ENABLE_TUN="1"; else ENABLE_TUN="0"; fi; STEP=$((STEP + 1)) ;;
|
||||
@@ -259,12 +265,12 @@ build_container() {
|
||||
if [[ "$OS_CHOICE" == "alpine" ]]; then OS_VERSION="3.20"; fi
|
||||
if [[ "$OS_CHOICE" == "ubuntu" ]]; then OS_VERSION="24.04"; fi
|
||||
|
||||
msg_info "Locating Imperial Archives for $OS_CHOICE"
|
||||
msg_info "Locating Files for $OS_CHOICE"
|
||||
local template_search="${OS_CHOICE}-${OS_VERSION}"
|
||||
local template=$(pveam available -section system | grep "$template_search" | awk '{print $2}' | tail -n1)
|
||||
|
||||
if [[ -z "$template" ]]; then
|
||||
msg_error "Archive not found in system records."
|
||||
msg_error "Files not found in system records."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -272,7 +278,7 @@ build_container() {
|
||||
pveam download local "$template" $STD
|
||||
fi
|
||||
|
||||
msg_info "Manifesting Structure"
|
||||
msg_info "Welding Structure"
|
||||
|
||||
local VLAN_OPT=""
|
||||
if [[ -n "$VLAN_TAG" ]]; then
|
||||
@@ -313,11 +319,11 @@ build_container() {
|
||||
}
|
||||
|
||||
echo_default() {
|
||||
msg_info "Deploying with Default Imperial Stance:"
|
||||
msg_info "Deploying with Defaults for ${GOLD}${app_name}${NC}:"
|
||||
echo -e " ${BLUE}OS Version:${NC} ${GOLD}${OS_CHOICE} ${OS_VERSION}${NC}"
|
||||
echo -e " ${BLUE}Resources:${NC} ${GOLD}${CORE_COUNT} Cores, ${RAM_SIZE}MB RAM, ${DISK_SIZE}GB Storage${NC}"
|
||||
echo -e " ${BLUE}Network:${NC} ${GOLD}${NET} on ${BRG}${NC}"
|
||||
echo -e " ${BLUE}ID & Name:${NC} ${GOLD}Node ${CT_ID} (${HN})${NC}"
|
||||
echo -e " ${BLUE}ID & Name:${NC} ${GOLD}LXC ${CT_ID} (${HN})${NC}"
|
||||
echo ""
|
||||
sleep 2
|
||||
}
|
||||
@@ -330,11 +336,11 @@ description() {
|
||||
|
||||
echo -e "\n${GOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e " ${GOLD}${BOLD}PROVISION COMPLETE${NC}"
|
||||
echo -e " ${BLUE}Access :${NC} ${GOLD}${portal}${NC}"
|
||||
echo -e " ${BLUE}Access: ${NC} ${GOLD}${portal}${NC}"
|
||||
if [[ "$ENABLE_SSH" == "1" ]]; then
|
||||
echo -e " ${BLUE}SSH Authority:${NC} ${GOLD}ssh root@${IP}${NC}"
|
||||
fi
|
||||
echo -e " ${BLUE}Archive Path:${NC} ${GOLD}${INSTALL_LOG}${NC}"
|
||||
echo -e " ${BLUE}Log Path:${NC} ${GOLD}${INSTALL_LOG}${NC}"
|
||||
echo -e "${GOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ manifest_provision() {
|
||||
}
|
||||
|
||||
network_check() {
|
||||
msg_info "Verifying Fleet Uplink (1.1.1.1 / 1.0.0.1)..."
|
||||
msg_info "Verifying Internet Availability (1.1.1.1 / 1.0.0.1)..."
|
||||
if ping -c 1 -W 2 1.1.1.1 &>/dev/null || ping -c 1 -W 2 1.0.0.1 &>/dev/null; then
|
||||
msg_ok "Network OK."
|
||||
else
|
||||
@@ -86,7 +86,7 @@ network_check() {
|
||||
}
|
||||
|
||||
github_api_check() {
|
||||
msg_info "Querying Archive AP..."
|
||||
msg_info "Checking Github API Token..."
|
||||
local api_response=$(curl -s https://api.github.com/rate_limit)
|
||||
local remaining=$(echo "$api_response" | grep -A 2 '"core"' | grep '"remaining"' | tr -dc '0-9')
|
||||
if [[ -n "$remaining" ]]; then
|
||||
@@ -117,7 +117,7 @@ header_info() {
|
||||
fi
|
||||
echo -e " ${PURPLE}Install provided by the courtesy of Dynasty Revolution${NC}"
|
||||
echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
[[ -n "$app_name" ]] && echo -e " ${BLUE}STANCE:${NC} Deployment of ${GOLD}${app_name}${NC}"
|
||||
[[ -n "$app_name" ]] && echo -e " ${BLUE}Task:${NC} Deployment of ${GOLD}${app_name}${NC}"
|
||||
[[ -n "$app_name" ]] && echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo ""
|
||||
}
|
||||
@@ -129,6 +129,14 @@ exit_script() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
parse_dev_mode() {
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == "--dev" ]] || [[ "$arg" == "-v" ]] || [[ "$arg" == "--verbose" ]]; then
|
||||
export DEV_MODE_LOGS="true"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
pve_check() { command -v pveversion >/dev/null 2>&1 || exit 1; }
|
||||
shell_check() { [[ -n "$BASH_VERSION" ]] || exit 1; }
|
||||
root_check() { [[ "$EUID" -eq 0 ]] || exit 1; }
|
||||
|
||||
@@ -24,14 +24,14 @@ VERSION="1.0.0.0"
|
||||
MODULE_PATH="modules/provision/operating-systems/debian-lxc.sh"
|
||||
var_tags="os;base"
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_disk="2"
|
||||
var_ram="1024"
|
||||
var_disk="4"
|
||||
var_os="debian"
|
||||
var_version="13"
|
||||
|
||||
start
|
||||
|
||||
msg_info "Granting you options for $OS_CHOICE..."
|
||||
msg_info "Grounding $OS_CHOICE..."
|
||||
|
||||
cat << 'EOF' > /tmp/dynr_install.sh
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -53,10 +53,10 @@ UPDATE
|
||||
chmod +x /usr/local/bin/update
|
||||
EOF
|
||||
|
||||
msg_info "Injecting OS into LXC $CT_ID..."
|
||||
msg_info "Welding OS into LXC $CT_ID..."
|
||||
pct push "$CT_ID" /tmp/dynr_install.sh /root/dynr_install.sh
|
||||
|
||||
msg_info "Executing Internal Provisioning..."
|
||||
msg_info "Sanding Provision..."
|
||||
manifest_provision pct exec "$CT_ID" -- bash /root/dynr_install.sh
|
||||
|
||||
pct exec "$CT_ID" -- rm /root/dynr_install.sh
|
||||
|
||||
Reference in New Issue
Block a user