shfmt reformat

This commit is contained in:
Tobias Cudnik 2023-05-08 10:52:36 +02:00
parent 3e1da5b2f0
commit 8c5073fa82

View file

@ -19,7 +19,7 @@ cat << "EOF"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EOF
)}
); }
if [ $(id -u) -ne 0 ]; then
echo "This script must be run as root"
@ -49,8 +49,7 @@ usage () {
exit 1
}
while getopts evab:t: flag
do
while getopts evab:t: flag; do
case "${flag}" in
e)
INSTALL_TYPE="ee"
@ -147,10 +146,10 @@ set_buildinfo() {
done
fi
echo "-----------Build Options-----------------------------"
echo " EE or CE: $INSTALL_TYPE";
echo " Build Type: $BUILD_TYPE";
echo " Build Tag: $BUILD_TAG";
echo " Image Tag: $IMAGE_TAG";
echo " EE or CE: $INSTALL_TYPE"
echo " Build Type: $BUILD_TYPE"
echo " Build Tag: $BUILD_TAG"
echo " Image Tag: $IMAGE_TAG"
echo "-----------------------------------------------------"
}
@ -226,12 +225,11 @@ setup_nmctl() {
# wait_seconds - wait for the specified period of time
wait_seconds() { (
for ((a=1; a <= $1; a++))
do
for ((a = 1; a <= $1; a++)); do
echo ". . ."
sleep 1
done
)}
); }
# confirm - get user input to confirm that they want to perform the next step
confirm() { (
@ -241,8 +239,14 @@ confirm() {(
while true; do
read -p 'Does everything look right? [y/n]: ' yn
case $yn in
[Yy]* ) override="true"; break;;
[Nn]* ) echo "exiting..."; exit 1;;
[Yy]*)
override="true"
break
;;
[Nn]*)
echo "exiting..."
exit 1
;;
*) echo "Please answer yes or no." ;;
esac
done
@ -269,7 +273,7 @@ local_install_setup() {(
cp docker/wait.sh /root/wait.sh
cd ../../
rm -rf netmaker-tmp
)}
); }
# install_dependencies - install necessary packages to run netmaker
install_dependencies() {
@ -393,7 +397,10 @@ set_install_vars() {
NETMAKER_BASE_DOMAIN=nm.$(echo $IP_ADDR | tr . -).nip.io
COREDNS_IP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')
SERVER_PUBLIC_IP=$IP_ADDR
MASTER_KEY=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo '')
MASTER_KEY=$(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
echo ''
)
DOMAIN_TYPE=""
echo "-----------------------------------------------------"
echo "Would you like to use your own domain for netmaker, or an auto-generated domain?"
@ -498,7 +505,10 @@ set_install_vars() {
MQ_USERNAME="$GET_MQ_USERNAME"
fi
MQ_PASSWORD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo '')
MQ_PASSWORD=$(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
echo ''
)
if [ -z $AUTO_BUILD ]; then
select domain_option in "Auto Generated Password" "Input Your Own Password"; do
@ -508,8 +518,7 @@ set_install_vars() {
break
;;
2)
while true
do
while true; do
echo "Enter your Password For MQ: "
read -s GET_MQ_PASSWORD
echo "Enter your password again to confirm: "
@ -543,7 +552,10 @@ set_install_vars() {
TURN_USERNAME="$GET_TURN_USERNAME"
fi
TURN_PASSWORD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo '')
TURN_PASSWORD=$(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
echo ''
)
if [ -z $AUTO_BUILD ]; then
select domain_option in "Auto Generated Password" "Input Your Own Password"; do
@ -553,8 +565,7 @@ set_install_vars() {
break
;;
2)
while true
do
while true; do
echo "Enter your Password For TURN: "
read -s GET_TURN_PASSWORD
echo "Enter your password again to confirm: "
@ -605,7 +616,6 @@ install_netmaker() {
echo "Pulling config files..."
COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/compose/docker-compose.yml"
CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/Caddyfile"
if [ "$INSTALL_TYPE" = "ee" ]; then
@ -661,8 +671,7 @@ install_netmaker() {
test_connection() {
echo "Testing Caddy setup (please be patient, this may take 1-2 minutes)"
for i in 1 2 3 4 5 6 7 8
do
for i in 1 2 3 4 5 6 7 8; do
curlresponse=$(curl -vIs https://api.${NETMAKER_BASE_DOMAIN} 2>&1)
if [[ "$i" == 8 ]]; then