Aesthetics
This commit is contained in:
@@ -1,17 +1,6 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i bash -p gum openssl sops ssh-to-age age sshpass envsubst pciutils usbutils mosquitto
|
#!nix-shell -i bash -p gum openssl sops ssh-to-age age sshpass envsubst pciutils usbutils mosquitto
|
||||||
|
|
||||||
prerun_action() {
|
|
||||||
echo -e "$1"
|
|
||||||
SETUP_ANSWER="$(gum input --placeholder 'Type "done" when you have finished.')"
|
|
||||||
if [[ "$SETUP_ANSWER" == "done" ]]; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
echo ' ❌ Aborting - you did not type "done".'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
necessary_credentials() {
|
necessary_credentials() {
|
||||||
#TARGET SETTINGS
|
#TARGET SETTINGS
|
||||||
echo -e "\n\n ➡️ Please provide the IP address of the target host :"
|
echo -e "\n\n ➡️ Please provide the IP address of the target host :"
|
||||||
@@ -230,7 +219,7 @@ files_generation() {
|
|||||||
echo -e "\n ✅ Adapting the docker configuration to your hardware..."
|
echo -e "\n ✅ Adapting the docker configuration to your hardware..."
|
||||||
DEVICES_BLOCK=""
|
DEVICES_BLOCK=""
|
||||||
if [[ "$TARGET_GRAPHICS_RENDERER" == "true" ]]; then
|
if [[ "$TARGET_GRAPHICS_RENDERER" == "true" ]]; then
|
||||||
DEVICES_BLOCK+=" - /dev/dri/renderD300:/dev/dri/renderD300\n"
|
DEVICES_BLOCK+=" - /dev/dri/renderD128:/dev/dri/renderD128\n"
|
||||||
fi
|
fi
|
||||||
if [[ "$TARGET_USB_CORAL" == "true" ]]; then
|
if [[ "$TARGET_USB_CORAL" == "true" ]]; then
|
||||||
DEVICES_BLOCK+=" - /dev/bus/usb:/dev/bus/usb\n"
|
DEVICES_BLOCK+=" - /dev/bus/usb:/dev/bus/usb\n"
|
||||||
@@ -482,6 +471,10 @@ deploy() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postrun_action() {
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
nixos_update() {
|
nixos_update() {
|
||||||
echo -e "\n\n 🔄 Updating NixOS on the remote server..."
|
echo -e "\n\n 🔄 Updating NixOS on the remote server..."
|
||||||
echo "coming soon !"
|
echo "coming soon !"
|
||||||
@@ -498,9 +491,9 @@ cat <<EOF
|
|||||||
░███ ░░█████ ░███ ███░░░███ ░░███ ███ ███ ░███
|
░███ ░░█████ ░███ ███░░░███ ░░███ ███ ███ ░███
|
||||||
█████ ░░█████ █████ █████ █████ ░░░███████░ ░░█████████
|
█████ ░░█████ █████ █████ █████ ░░░███████░ ░░█████████
|
||||||
░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░ ░░░░░░░░░
|
░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░ ░░░░░░░░░
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
█████████ █████
|
█████████ █████
|
||||||
███░░░░░███ ░░███
|
███░░░░░███ ░░███
|
||||||
░███ ░███ ████████ █████ ████ █████ ███ █████ ░███████ ██████ ████████ ██████
|
░███ ░███ ████████ █████ ████ █████ ███ █████ ░███████ ██████ ████████ ██████
|
||||||
@@ -522,7 +515,9 @@ echo $ACTION_ANSWER
|
|||||||
|
|
||||||
if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then
|
if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then
|
||||||
echo -e "\n ➡️ Proceeding with deployment…"
|
echo -e "\n ➡️ Proceeding with deployment…"
|
||||||
prerun_action "\n\n ➡️ On the target host : start the computer and boot into the NixOS iso.\n Launch a console and set up a new user password."
|
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "➡️ On the target host : start the computer and boot into the NixOS iso.
|
||||||
|
Launch a console and set up a new user password."
|
||||||
|
gum confirm "Do you understand and wish to proceed?" || { echo " ❌ Aborting as requested."; exit 1; }
|
||||||
necessary_credentials
|
necessary_credentials
|
||||||
setup_ssh
|
setup_ssh
|
||||||
hardware_detection
|
hardware_detection
|
||||||
@@ -530,9 +525,12 @@ if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then
|
|||||||
files_generation
|
files_generation
|
||||||
disk_config_generation
|
disk_config_generation
|
||||||
deploy
|
deploy
|
||||||
|
postrun_action
|
||||||
elif [[ "$ACTION_ANSWER" == "[2] 💽 Deploy NixOS on a remote machine with a file configuration" ]]; then
|
elif [[ "$ACTION_ANSWER" == "[2] 💽 Deploy NixOS on a remote machine with a file configuration" ]]; then
|
||||||
echo -e "\n ➡️ Proceeding with deployment using a config file…"
|
echo -e "\n ➡️ Proceeding with deployment using a config file…"
|
||||||
prerun_action "\n\n ➡️ On the target host : start the computer and boot into the NixOS iso.\n Launch a console and set up a new user password."
|
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "➡️ On the target host : start the computer and boot into the NixOS iso.
|
||||||
|
Launch a console and set up a new user password."
|
||||||
|
gum confirm "Do you understand and wish to proceed?" || { echo " ❌ Aborting as requested."; exit 1; }
|
||||||
necessary_credentials_with_config
|
necessary_credentials_with_config
|
||||||
setup_ssh
|
setup_ssh
|
||||||
hardware_detection
|
hardware_detection
|
||||||
@@ -542,7 +540,10 @@ elif [[ "$ACTION_ANSWER" == "[2] 💽 Deploy NixOS on a remote machine with a fi
|
|||||||
deploy
|
deploy
|
||||||
elif [[ "$ACTION_ANSWER" == "[3] 🛠️ Update a NixOS remote machine" ]]; then
|
elif [[ "$ACTION_ANSWER" == "[3] 🛠️ Update a NixOS remote machine" ]]; then
|
||||||
echo -e "\n ➡️ Proceeding with update…"
|
echo -e "\n ➡️ Proceeding with update…"
|
||||||
prerun_action "\n\n ➡️ On the target host : make sure the NixOS installation you want to update is up-and-running, accessible with SSH."
|
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "➡️ On the target host : make sure the NixOS installation you want
|
||||||
|
to update is up-and-running, accessible with SSH.
|
||||||
|
"
|
||||||
|
gum confirm "Do you understand and wish to proceed?" || { echo " ❌ Aborting as requested."; exit 1; }
|
||||||
nixos_update
|
nixos_update
|
||||||
else
|
else
|
||||||
echo "Aborting - you did not type '1, 2 or 3'."
|
echo "Aborting - you did not type '1, 2 or 3'."
|
||||||
|
|||||||
Reference in New Issue
Block a user