Compare commits
2 Commits
7aae0c5ab5
...
e7e354b0e7
| Author | SHA1 | Date | |
|---|---|---|---|
| e7e354b0e7 | |||
| e9628a112c |
+5
-48
@@ -37,7 +37,7 @@ get_valid_input() {
|
|||||||
# Handle empty input
|
# Handle empty input
|
||||||
if [[ -z "${INPUT}" ]]; then
|
if [[ -z "${INPUT}" ]]; then
|
||||||
if [[ "${MANDATORY}" == true ]]; then
|
if [[ "${MANDATORY}" == true ]]; then
|
||||||
gum style --foreground "#ff0000" -- "✖ This field is mandatory."
|
gum style --foreground "#ff0000" -- " ❌ This field is mandatory."
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
INPUT=""
|
INPUT=""
|
||||||
@@ -51,7 +51,7 @@ get_valid_input() {
|
|||||||
export "${VAR_NAME}"="${INPUT}"
|
export "${VAR_NAME}"="${INPUT}"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
gum style --foreground "#ff0000" -- "✖ Invalid format. Please try again."
|
gum style --foreground "#ff0000" -- " ❌ Invalid format. Please try again."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
export "${VAR_NAME}"="${INPUT}"
|
export "${VAR_NAME}"="${INPUT}"
|
||||||
@@ -69,50 +69,14 @@ cleanup() {
|
|||||||
|
|
||||||
rm -${DIR_RM_FLAGS} ${TMP_FILES_PATH}/
|
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}
|
kill ${BRIDGE_PID}
|
||||||
fi
|
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() {
|
hierarchy_preparation() {
|
||||||
echod "\n 🔄 Preparing the folder hierarchy for the final configuration..."
|
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
|
# Script folders
|
||||||
mkdir -${MKDIR_FLAGS} ${TMP_FILES_PATH}/config
|
mkdir -${MKDIR_FLAGS} ${TMP_FILES_PATH}/config
|
||||||
mkdir -${MKDIR_FLAGS} ${TMP_FILES_PATH}/logs
|
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
|
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 ---<
|
# --- MAIN FUNCTIONS ---<
|
||||||
|
|
||||||
|
|
||||||
@@ -1003,7 +960,6 @@ set -euo pipefail
|
|||||||
clear
|
clear
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
compatibility_check
|
|
||||||
# --- PRE MAIN LOGIC ---<
|
# --- PRE MAIN LOGIC ---<
|
||||||
|
|
||||||
|
|
||||||
@@ -1033,4 +989,5 @@ else
|
|||||||
else
|
else
|
||||||
launch_tui
|
launch_tui
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# --- MAIN LOGIC ---<
|
||||||
+1
-1
@@ -5,7 +5,7 @@ set -euo pipefail
|
|||||||
# This script clones the repository and launches the NixOS deployment script.
|
# This script clones the repository and launches the NixOS deployment script.
|
||||||
|
|
||||||
REPO_URL="https://gittea.dev/numbus/numbus.git"
|
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..."
|
echo "\n ☁️ Initializing Numbus Installer..."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user