script to create K3S_YAML secrets, updated
This commit is contained in:
parent
c3df0a72d3
commit
593eb90369
1 changed files with 18 additions and 3 deletions
|
|
@ -1,9 +1,24 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "Provide the public DNS name or IP address of the k3s server:"
|
# Define a function to read from the terminal
|
||||||
read -r server_url
|
read_from_terminal() {
|
||||||
|
# Check if a tty is available
|
||||||
|
if [[ -t 0 ]]; then
|
||||||
|
# Use 'read -p' if standard input is an interactive terminal
|
||||||
|
read -p "$1" user_input
|
||||||
|
else
|
||||||
|
printf "\n" > /dev/tty
|
||||||
|
# If not interactive (e.g. piped), read from /dev/tty
|
||||||
|
# The '< /dev/tty' redirects input for 'read' to the terminal device
|
||||||
|
read -p "$1" user_input < /dev/tty
|
||||||
|
fi
|
||||||
|
echo "$user_input"
|
||||||
|
}
|
||||||
|
|
||||||
|
server_url=$(read_from_terminal "Server URL (public DNS name or IP address for the k3s server): ")
|
||||||
|
|
||||||
|
workdir=$(mktemp -d /tmp/encode-k3s-yaml.XXXXXX)
|
||||||
|
|
||||||
workdir = $(mktemp -d /tmp/encode-k3s-yaml.XXXXXX)
|
|
||||||
cd $workdir
|
cd $workdir
|
||||||
echo "Working directory: $workdir"
|
echo "Working directory: $workdir"
|
||||||
pwd
|
pwd
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue