Add offline license capture to setup
This commit is contained in:
1 parent
9ce9efc82e
commit
f407a9331e
4 files changed
+198
-29
No files matched your search
@@ -42,7 +42,7 @@ W=70
|
||||
|
||||
# ── Welcome ────────────────────────────────────────────────
|
||||
whiptail --title "$TITLE" \
|
||||
--msgbox "\nWelcome to the Nexus One AI installer.\n\nThis wizard will configure your network and install the AI stack.\n\nMake sure this server is connected to the internet before continuing." \
|
||||
--msgbox "\nWelcome to the Nexus One AI installer.\n\nThis wizard will configure your network, capture license/customer details, and install the AI stack.\n\nMake sure this server is connected to the internet before continuing." \
|
||||
$H $W
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
@@ -50,7 +50,7 @@ whiptail --title "$TITLE" \
|
||||
# ════════════════════════════════════════════════════════════
|
||||
|
||||
NET_MODE=$(whiptail --title "$TITLE" \
|
||||
--menu "\nStep 1 of 3: Network Configuration\n\nHow should this server get its IP address?" \
|
||||
--menu "\nStep 1 of 4: Network Configuration\n\nHow should this server get its IP address?" \
|
||||
$H $W 2 \
|
||||
"DHCP" "Automatic (get IP from network)" \
|
||||
"Static" "Manual (enter IP address)" \
|
||||
@@ -131,11 +131,35 @@ EOF
|
||||
fi
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# STEP 2: SELECT TIER
|
||||
# STEP 2: LICENSE / CUSTOMER DETAILS
|
||||
# ════════════════════════════════════════════════════════════
|
||||
|
||||
CUSTOMER_NAME=$(whiptail --title "$TITLE" \
|
||||
--inputbox "\nStep 2 of 4: License & Customer Details\n\nCustomer / organisation name:" \
|
||||
$H $W "" 3>&1 1>&2 2>&3)
|
||||
|
||||
CUSTOMER_ID=$(whiptail --title "$TITLE" \
|
||||
--inputbox "\nStep 2 of 4: License & Customer Details\n\nCustomer ID / project code:\n\nLeave blank for evaluation or field staging." \
|
||||
$H $W "" 3>&1 1>&2 2>&3)
|
||||
|
||||
CONTACT_EMAIL=$(whiptail --title "$TITLE" \
|
||||
--inputbox "\nStep 2 of 4: License & Customer Details\n\nCustomer/admin contact email:\n\nLeave blank if unavailable on site." \
|
||||
$H $W "" 3>&1 1>&2 2>&3)
|
||||
|
||||
LICENSE_KEY=$(whiptail --title "$TITLE" \
|
||||
--passwordbox "\nStep 2 of 4: License & Customer Details\n\nLicense key / activation code:\n\nLeave blank for offline field staging. Models and keys can be added later." \
|
||||
$H $W "" 3>&1 1>&2 2>&3)
|
||||
|
||||
SUPPORT_UNTIL=$(whiptail --title "$TITLE" \
|
||||
--inputbox "\nStep 2 of 4: License & Customer Details\n\nSupport valid until (YYYY-MM-DD):\n\nLeave blank if not issued yet." \
|
||||
$H $W "" 3>&1 1>&2 2>&3)
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# STEP 3: SELECT TIER
|
||||
# ════════════════════════════════════════════════════════════
|
||||
|
||||
TIER=$(whiptail --title "$TITLE" \
|
||||
--menu "\nStep 2 of 3: Select AI Package Tier\n\nChoose the tier that matches your hardware:" \
|
||||
--menu "\nStep 3 of 4: Select AI Package Tier\n\nChoose the tier that matches your hardware:" \
|
||||
$H $W 4 \
|
||||
"starter" "Starter — 1× RTX 5090 / 32GB VRAM · Small team" \
|
||||
"basic" "Entry — 1× NVIDIA RTX Pro 6000 (96GB) · Up to 20 users" \
|
||||
@@ -144,11 +168,11 @@ TIER=$(whiptail --title "$TITLE" \
|
||||
3>&1 1>&2 2>&3)
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# STEP 3: SELECT AI TOOLS
|
||||
# STEP 4: SELECT AI TOOLS
|
||||
# ════════════════════════════════════════════════════════════
|
||||
|
||||
TOOLS=$(whiptail --title "$TITLE" \
|
||||
--checklist "\nStep 3 of 3: Select AI Tools to Install\n\nSpace to toggle, Enter to confirm:" \
|
||||
--checklist "\nStep 4 of 4: Select AI Tools to Install\n\nSpace to toggle, Enter to confirm:" \
|
||||
$H $W 8 \
|
||||
"ollama" "Ollama + Open WebUI (LLM inference + chat UI)" ON \
|
||||
"jupyterlab" "JupyterLab (Notebook environment)" ON \
|
||||
@@ -167,9 +191,13 @@ TOOLS=$(whiptail --title "$TITLE" \
|
||||
# Format tools list for display
|
||||
TOOLS_DISPLAY=$(echo "$TOOLS" | tr -d '"' | tr ' ' '\n' | sed 's/^/ · /' | tr '\n' '\n')
|
||||
MY_IP=$(hostname -I | awk '{print $1}')
|
||||
LICENSE_DISPLAY="Field staging / evaluation"
|
||||
if [ -n "$LICENSE_KEY" ]; then
|
||||
LICENSE_DISPLAY="Provided"
|
||||
fi
|
||||
|
||||
whiptail --title "$TITLE" \
|
||||
--yesno "\nReady to install. Please confirm:\n\nNetwork: ${NET_MODE} (${MY_IP})\nTier: ${TIER}\n\nTools:\n${TOOLS_DISPLAY}\n\nThis will take 20–40 minutes.\nThe server will reboot once during install (NVIDIA drivers).\n\nContinue?" \
|
||||
--yesno "\nReady to install. Please confirm:\n\nNetwork: ${NET_MODE} (${MY_IP})\nCustomer: ${CUSTOMER_NAME:-Not entered}\nLicense: ${LICENSE_DISPLAY}\nTier: ${TIER}\n\nTools:\n${TOOLS_DISPLAY}\n\nThis will take 20–40 minutes.\nThe server will reboot once during install (NVIDIA drivers).\n\nContinue?" \
|
||||
$H $W
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
@@ -202,6 +230,30 @@ TIER=${TIER}
|
||||
SKIP_ROLES=${SKIP_ROLES}
|
||||
EOF
|
||||
|
||||
export CUSTOMER_NAME CUSTOMER_ID CONTACT_EMAIL LICENSE_KEY SUPPORT_UNTIL TIER
|
||||
python3 - <<'PY'
|
||||
import json, os, time
|
||||
|
||||
payload = {
|
||||
"schema": "cezen.license.v1",
|
||||
"customer_name": os.environ.get("CUSTOMER_NAME", "").strip(),
|
||||
"customer_id": os.environ.get("CUSTOMER_ID", "").strip(),
|
||||
"contact_email": os.environ.get("CONTACT_EMAIL", "").strip(),
|
||||
"license_key": os.environ.get("LICENSE_KEY", "").strip(),
|
||||
"tier": os.environ.get("TIER", "basic").strip(),
|
||||
"support_until": os.environ.get("SUPPORT_UNTIL", "").strip(),
|
||||
"install_type": "licensed" if os.environ.get("LICENSE_KEY", "").strip() else "field-staging",
|
||||
"issued_by": "Cezen",
|
||||
"captured_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
||||
"signature_status": "unsigned-field-install",
|
||||
}
|
||||
|
||||
with open("/opt/cezen/license.json", "w") as f:
|
||||
json.dump(payload, f, indent=2)
|
||||
PY
|
||||
chown root:cezen /opt/cezen/license.json 2>/dev/null || true
|
||||
chmod 0640 /opt/cezen/license.json
|
||||
|
||||
# Mark as configured so this wizard doesn't run again
|
||||
touch /opt/cezen/.setup-done
|
||||
|
||||
|
||||
Reference in new issue
Block a user