You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
|
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
|
|
|
TARGET="$(readlink "$SOURCE")"
|
|
|
|
if [[ $TARGET == /* ]]; then
|
|
|
|
#echo "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'"
|
|
|
|
SOURCE="$TARGET"
|
|
|
|
else
|
|
|
|
DIR="$( dirname "$SOURCE" )"
|
|
|
|
#echo "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')"
|
|
|
|
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
SRPATH="$( dirname "$SOURCE" )"
|
|
|
|
SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
|
|
if [ "$SFPATH" != "$SRPATH" ]; then
|
|
|
|
RDIR=$SRPATH # relativ path directory
|
|
|
|
fi
|
|
|
|
|
|
|
|
cwdir=$PWD
|
|
|
|
wdir=$SFPATH
|
|
|
|
if [ "$cwdir" != "$wdir" ]; then
|
|
|
|
cd $wdir
|
|
|
|
fi
|
|
|
|
|
|
|
|
docker rmi swarmlabadmin > /dev/null 2>&1
|
|
|
|
docker container rm swarmlabadmin > /dev/null 2>&1
|
|
|
|
env nodepath=$PWD \
|
|
|
|
USER_NAME=${USER} \
|
|
|
|
USER_ID=$(id -u ${USER}) \
|
|
|
|
GROUP_NAME=$(id -g -n ${USER}) \
|
|
|
|
GROUP_ID=$(id -g ${USER}) \
|
|
|
|
docker-compose -f run.yml up -d
|
|
|
|
#docker-compose -f run.yml up -d > /dev/null 2>&1
|
|
|
|
|
|
|
|
cd $cwdir
|
|
|
|
|