36 lines
968 B
Bash
36 lines
968 B
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if [[ "$EUID" -ne 0 ]]; then
|
|
echo -e "\e[31m[FATAL]\e[39m Currently this script requires being ran as root user - please try again as root."
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "\n\nINSTALL LOG: $(date --rfc-3339=seconds)\n" >> /tmp/multiplane.log
|
|
|
|
info() {
|
|
echo -e "\e[34m[INFO]\e[39m $1"
|
|
echo "[INFO] $1" >> /tmp/multiplane.log
|
|
}
|
|
|
|
debug() {
|
|
if [[ ! -z "$DEBUG" ]]; then
|
|
echo -e "\e[96m[DEBUG]\e[39m $1"
|
|
fi
|
|
echo "[DEBUG] $1" >> /tmp/multiplane.log
|
|
}
|
|
|
|
warn() {
|
|
echo -e "\e[33m[WARNING]\e[39m $1"
|
|
echo "[WARNING] $1" >> /tmp/multiplane.log
|
|
}
|
|
|
|
fatal() {
|
|
echo -e "\e[31m[FATAL]\e[39m $1"
|
|
echo "[FATAL] $1" >> /tmp/multiplane.log
|
|
exit 1
|
|
}
|
|
|
|
gum input --placeholder "Cluster Domain:" --prompt "* " --width 80 --value "cluster.local" > yq -i '.k0s.hostname = "$1"' config.toml
|
|
gum input --placeholder "Node IP Range:" --prompt "* " --width 80 --value "10.1.0.0/24" > yq -i '.k0s.private_ip_range = "$1"' config.toml |