Updated the script. Updated the configuration files. Script need a lot of work.

This commit is contained in:
Raphaël Numbus
2026-03-14 11:50:09 +01:00
parent 99d19af39a
commit d09e261b14
6 changed files with 199 additions and 22 deletions
+44 -8
View File
@@ -36,6 +36,12 @@ NECESSARY_BACKUP_SERVER_VARIABLES_LIST=(
SERVICES_SELECTED_WEB_APPLICATIONS
)
OPTIONAL_BACKUP_SERVER_VARIABLES_LIST=(
# SERVICES SETTINGS
SELECTED_DNS_SERVICE_SUBDOMAIN
SELECTED_WEB_APPLICATIONS_SUBDOMAIN
)
NECESSARY_COMPUTER_VARIABLES_LIST=(
#LIVE TARGET SETTINGS
LIVE_TARGET_IP
@@ -52,6 +58,9 @@ NECESSARY_COMPUTER_VARIABLES_LIST=(
NETWORK_SUBNET
NETWORK_ROUTER_IP
NETWORK_HOME_COMPUTER_IP
)
OPTIONAL_COMPUTER_VARIABLES_LIST=(
# SERVICES SETTINGS
SERVICES_SELECTED_SYSTEM
SERVICES_SELECTED_APPLICATIONS
@@ -87,6 +96,12 @@ NECESSARY_SERVER_VARIABLES_LIST=(
SERVICES_SELECTED_WEB_APPLICATIONS
)
OPTIONAL_SERVER_VARIABLES_LIST=(
# SERVICES SETTINGS
SELECTED_DNS_SERVICE_SUBDOMAIN
SELECTED_WEB_APPLICATIONS_SUBDOMAIN
)
NECESSARY_TV_VARIABLES_LIST=(
#LIVE TARGET SETTINGS
LIVE_TARGET_IP
@@ -103,6 +118,9 @@ NECESSARY_TV_VARIABLES_LIST=(
NETWORK_SUBNET
NETWORK_ROUTER_IP
NETWORK_HOME_TV_IP
)
OPTIONAL_TV_VARIABLES_LIST=(
# SERVICES SETTINGS
SERVICES_SELECTED_SYSTEM
SERVICES_SELECTED_WEB_APPLICATIONS
@@ -119,11 +137,15 @@ WEB_APPLICATIONS_LIST=(
"frigate"
"gitea"
"home-assistant"
"homepage"
"immich"
"it-tools"
"jellyfin"
"n8n"
"netbootxyz"
"nextcloud"
"ntfy"
"odoo"
"passbolt"
"uptime-kuma"
"vscodium"
@@ -145,11 +167,15 @@ WEB_APPLICATIONS_DESCRIPTION=(
"Frigate [Home Assistant required] : AI-powered NVR for smart security cameras"
"Gitea : A lightweight, self-hosted Git service like GitHub"
"Home-Assistant : Open-source home automation to control all your devices"
"Homepage : A modern dashboard to organize your applications and services"
"Immich : Self-hosted Google Photos alternative for photos and videos"
"IT-tools : Handy collection of online tools for developers"
"Jellyfin : A self-hosted media server to stream your movies and music"
"N8n : Workflow automation tool"
"netboot.xyz : PXE boot various OS installers and utilities"
"Nextcloud : A self-hosted productivity platform, like Google Drive & Office"
"Ntfy : Send push notifications to your phone or desktop via HTTP"
"Odoo : Open-source business management suite (ERP & CRM)"
"Passbolt: An open-source, security-first password manager for teams"
"Uptime-Kuma : A fancy self-hosted monitoring tool"
"VSCodium : An open-source version of VScode in your web browser"
@@ -170,8 +196,8 @@ user_input() {
local SENSITIVE="${6:-false}"
while true; do
[[ "$SENSITIVE" == "false" ]] && INPUT_VALUE=$(gum input --placeholder "${PLACEHOLDER}" --header "${HEADER}")
[[ "$SENSITIVE" == "true" ]] && INPUT_VALUE=$(gum input --password --placeholder "${PLACEHOLDER}" --header "${HEADER}")
[[ "${SENSITIVE}" == "false" ]] && INPUT_VALUE=$(gum input --placeholder "${PLACEHOLDER}" --header "${HEADER}")
[[ "${SENSITIVE}" == "true" ]] && INPUT_VALUE=$(gum input --password --placeholder "${PLACEHOLDER}" --header "${HEADER}")
if [[ -z "${INPUT_VALUE}" ]]; then
echo "❌ Error: Input cannot be empty. Please provide the necessary information."
@@ -246,19 +272,21 @@ import_variables() {
local CONFIG_PATH="$(gum file)"
source "${CONFIG_PATH}"
local MISSING=0
local MISSING=false
for VAR in "${VARIABLES_LIST[@]}"; do
if [[ -v "${VAR}" && -n "${!VAR}" ]]; then
gum style "✅ "${VAR}" imported successfully from the config file"
else
gum style "❌ "${VAR}" is missing or empty"
MISSING=1
MISSING=true
fi
done
if [[ "${MISSING}" -eq 1 ]]; then
echo -e "\n❌ Please check your configuration file to include all necessary variables"
exit 1
if [[ "${MISSING}" == "true" ]]; then
if [[ "${NECESSARY}" = "true" ]]; then
echo -e "\n❌ Please check your configuration file to include all necessary variables"
exit 1
fi
fi
if [[ "${DEBUG:-false}" == "true" ]]; then
@@ -1031,7 +1059,15 @@ EOF
sleep 1
# Choose the action
ACTION_ANSWER=$(gum choose "[1] 🌐 Deploy NixOS on a remote machine" "[2] 💽 Deploy NixOS on a remote machine with a file configuration" "[3] 🛠️ Update a NixOS remote machine")
ACTION_ANSWER=$(gum choose \
"[1.A] 🌍 Deploy interactively a numbus-server" \
"[1.B] 🌍 Deploy non-interactively (with a config file) a numbus-server" \
"[2.A] 💾 Deploy interactively a numbus-backup-server" \
"[2.B] 💾 Deploy non-interactively (with a config file) a numbus-backup-server" \
"[3.A] 💻 Deploy interactively a numbus-computer" \
"[3.B] 💻 Deploy non-interactively (with a config file) a numbus-computer" \
"[4.A] 📺 Deploy interactively a numbus-tv" \
"[4.B] 📺 Deploy non-interactively (with a config file) a numbus-tv" )
if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then
TARGET_USER="nixos"