Misc fixes. Updated IPV4 regex.

This commit is contained in:
Raphaël Numbus
2026-05-29 21:38:05 +02:00
parent 1f508ad264
commit fc92aee0fe
+7 -7
View File
@@ -97,7 +97,7 @@ launch_gui() {
} }
hierarchy_preparation() { hierarchy_preparation() {
echod "\n 🔄 Preparing the folder hierarchy for the final configuration..." echod "\n 🔄 Preparing the folder hierarchy for the final configuration...\n"
# Extra files folders # Extra files folders
mkdir -${MKDIR_FLAGS} ${TMP_EXTRA_PATH}/home/numbus-admin/.ssh/ mkdir -${MKDIR_FLAGS} ${TMP_EXTRA_PATH}/home/numbus-admin/.ssh/
@@ -112,13 +112,13 @@ hierarchy_preparation() {
setup_ssh() { setup_ssh() {
edit_var() { edit_var() {
echo -e "${1}" echo -e "${1}"
echo -e " Please check the credentials provided in the configuration." echo -e " Please check the credentials provided in the configuration."
echo -e "\n ➡️ Here are the current settings : echo -e "\n ➡️ Here are the current settings :
Target IP address : $(gum style --italic "\"${LIVE_TARGET_IP}\"") Target IP address : $(gum style --italic "\"${LIVE_TARGET_IP}\"")
Target password : $(gum style --italic "\"${LIVE_TARGET_PASSWORD}\"")" Target password : $(gum style --italic "\"${LIVE_TARGET_PASSWORD}\"")"
gum confirm "Are these correct ?" || { gum confirm "Are these correct ?" || {
get_valid_input "LIVE_TARGET_IP" "\n ➡️ Provide the IP address of your machine in a NixOS live environment :" "192.168.1.100" "IP_REGEX"; get_valid_input "LIVE_TARGET_IP" "➡️ Provide the IP address of your machine in a NixOS live environment :" "192.168.1.100" "IP_REGEX";
get_valid_input "LIVE_TARGET_IP" "\n ➡️ Provide the password of your machine in a NixOS live environment :" "password" "" "true" "true"; get_valid_input "LIVE_TARGET_IP" "➡️ Provide the password of your machine in a NixOS live environment :" "password" "" "true" "true";
continue; continue;
} }
gum confirm "Retry connection ?" || { gum confirm "Retry connection ?" || {
@@ -802,7 +802,7 @@ else
STDERR="/dev/null" STDERR="/dev/null"
fi fi
IP_REGEX='^([0-9]{1,3}\.){3}[0-9]{1,3}$' IP_REGEX='^(((?!25?[6-9])[12]\d|[1-9])?\d\.?\b){4}$'
SUBNET_REGEX='^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$' SUBNET_REGEX='^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$'
DOMAIN_REGEX='^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$' DOMAIN_REGEX='^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$'
EMAIL_REGEX='^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' EMAIL_REGEX='^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'