Compare commits

...

2 Commits

2 changed files with 6 additions and 49 deletions
+4 -47
View File
@@ -37,7 +37,7 @@ get_valid_input() {
# Handle empty input
if [[ -z "${INPUT}" ]]; then
if [[ "${MANDATORY}" == true ]]; then
gum style --foreground "#ff0000" -- " This field is mandatory."
gum style --foreground "#ff0000" -- " This field is mandatory."
continue
else
INPUT=""
@@ -51,7 +51,7 @@ get_valid_input() {
export "${VAR_NAME}"="${INPUT}"
break
else
gum style --foreground "#ff0000" -- " Invalid format. Please try again."
gum style --foreground "#ff0000" -- " Invalid format. Please try again."
fi
else
export "${VAR_NAME}"="${INPUT}"
@@ -69,50 +69,14 @@ cleanup() {
rm -${DIR_RM_FLAGS} ${TMP_FILES_PATH}/
if ps -p ${BRIDGE_PID:-} > /dev/null; then
if [[ -n "${BRIDGE_PID:-}" ]] && ps -p ${BRIDGE_PID} > /dev/null; then
kill ${BRIDGE_PID}
fi
}
compatibility_check() {
TEST_FAIL=0
if [[ -r /etc/os-release ]] && grep -qi '^ID=nixos\b' /etc/os-release; then
echo -e "\n ✅ NixOS system detected."
else
TEST_FAIL=$((TEST_FAIL + 1))
echo -e "\n ❌ You are not on a NixOS based system. This is required to continue."
fi
if [[ "$(uname -m)" == "x86_64" ]]; then
echo -e "\n ✅ x86_64 system detected."
else
TEST_FAIL=$((TEST_FAIL + 1))
echo -e "\n ❌ You are not on a x86_64 based system. This is required to continue."
fi
if [[ ${TEST_FAIL} -gt 0 ]]; then
COMPATIBILITY_OVERRIDE=$(gum choose --header "Some compatibility checks failed. The installation will very likely fail. Continue ?" \
"No" \
"Yes, I know what I am doing")
[[ "${COMPATIBILITY_OVERRIDE}" == "No" ]] && exit 1
[[ "${COMPATIBILITY_OVERRIDE}" != "No" ]] && echo -e "\n ⚠️ Continuing anyways, this is not supported by Numbus."
fi
return 0
}
hierarchy_preparation() {
echod "\n 🔄 Preparing the folder hierarchy for the final configuration..."
if [[ -e config/* ]]; then
echo " ⚠️ It seems you have already run this script. Previously generated files need to be cleaned up."
OLD_CONFIG_PATH="trash/$(date +"%Y-%m-%d-%Hh%M")/"
mkdir -${MKDIR_FLAGS} ${OLD_CONFIG_PATH}
mv -${MV_FLAGS} config/ ${OLD_CONFIG_PATH}
echo " ✅ Your files have been moved to the ${OLD_CONFIG_PATH} directory. You can retrieve them there if needed."
fi
# Script folders
mkdir -${MKDIR_FLAGS} ${TMP_FILES_PATH}/config
mkdir -${MKDIR_FLAGS} ${TMP_FILES_PATH}/logs
@@ -943,13 +907,6 @@ securely on a hidden sheet of paper or add it to your password manager (locally
echo $LIVE_TARGET_PASSWORD | sudo -S passwd numbus-admin
}
nix_update() {
echo -e "\n\n🔄 Updating NixOS on the remote server..."
nixos-rebuild --target-host numbus-admin@${LIVE_TARGET_IP} \
--use-remote-sudo switch --flake ${EXTRA_FILES_PATH}/etc/nixos#numbus-server
}
# --- MAIN FUNCTIONS ---<
@@ -1003,7 +960,6 @@ set -euo pipefail
clear
trap cleanup EXIT
compatibility_check
# --- PRE MAIN LOGIC ---<
@@ -1034,3 +990,4 @@ else
launch_tui
fi
fi
# --- MAIN LOGIC ---<
+1 -1
View File
@@ -5,7 +5,7 @@ set -euo pipefail
# This script clones the repository and launches the NixOS deployment script.
REPO_URL="https://gittea.dev/numbus/numbus.git"
INSTALL_DIR="/tmp/numbus-installer"
INSTALL_DIR="/run/user/$(id -u)/numbus-installer"
echo "\n ☁️ Initializing Numbus Installer..."