distinguish between OS types to get ip addresses
@@ -56,10 +56,11 @@ if [ ! -f ./docker-compose.yml ];
cp ../templates/.env ./.env
- if command -v ip;
- then
+ # Check OS type
+ OS_TYPE="$(uname -s)"
+ case $OS_TYPE in
+ Linux*)
# If Unix
- # ip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -1)
rawip=$(ip address list | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
rawip=`echo $rawip | sed 's/(%s)*\n/ /g'`
@@ -85,26 +86,55 @@ if [ ! -f ./docker-compose.yml ];
break
fi
done
+ ;;
+ Darwin*)
+ # If Darwin (MacOS)
+ rawip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
+
+ rawip=`echo $rawip | sed 's/(%s)*\n/ /g'`
+ IFS=' ' declare -a 'allips=($rawip)'
+
+ allips+=( 'Enter IP manually' )
+ echo ''
+ echo 'Please select your IP address or add one manually: '
+ PS3='Select option: '
+ select opt in "${allips[@]}"
+ do
+ if [ -z "${opt}" ];
+ then
+ echo "Wrong input select one of the options";
else
+ ip="$opt"
+
+ if [ "$opt" == "Enter IP manually" ];
+ then
+ read -p "Enter Ip: " ip
+ fi
+ break
+ fi
+ done
+ ;;
+ CYGWIN*)
# If Windows
ip=$(ipconfig | grep -Eo '(IPv4.*)' | grep -Eo '([0-9]*\.){3}[0-9]*' | tail -1)
# Workaround for Kafka (https://github.com/docker/for-win/issues/1829)
export COMPOSE_CONVERT_WINDOWS_PATHS=1
- fi
+ ;;
+ *)
+ fatal "Unsupported OS $OS_TYPE"
+ esac
- sed -i -e "s/SP_HOST=.*/SP_HOST=${ip}/g" .env
- sed -i -e "s/SP_KAFKA_HOST=.*/SP_KAFKA_HOST=${ip}/g" .env
+ # only update existing .env file
+ sed -i '' -e "s/SP_HOST=.*/SP_HOST=${ip}/g" .env
+ sed -i '' -e "s/SP_KAFKA_HOST=.*/SP_KAFKA_HOST=${ip}/g" .env
fi
-
-
docker-compose pull
-
docker-compose up -d
if [ $? -eq 0 ]; then
- echo "StreamPipes successfully started. open Browser and navigate to 'localhost'"
+ echo "StreamPipes successfully started. open Browser and navigate to 'http://localhost'"
else
echo "ERROR: There was a problem while starting StreamPipes"
fi
@@ -123,7 +153,6 @@ else
yes Y | docker-compose down -v
rm ./docker-compose.yml
rm ./.env
- rm -r ./config/
echo "All StreamPipes System informations were deleted. The system can now be installed again."
fi
@@ -132,4 +161,3 @@ else
fi
fi
-
