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.
62 lines
1.3 KiB
62 lines
1.3 KiB
3 years ago
|
#!/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
|
||
|
|
||
|
|
||
|
[ $# -eq 0 ] && { echo "Usage: $0 device-name"; exit 1; }
|
||
|
[ -z "$1" ] && { echo "Usage: $0 device-name"; exit 1; }
|
||
|
|
||
|
dir="$1"
|
||
|
|
||
|
dir1=/var/log-in/$dir
|
||
|
|
||
|
ex=$(docker exec -it dummy_service /bin/bash -c "mkdir \"/var/log-in/$dir\"")
|
||
|
(docker exec -i dummy_service sh -c "cat > /tmp/send.sh") <<EOF
|
||
|
if [ -d "$dir1" -a ! -h "$dir1" ];
|
||
|
then
|
||
|
echo "yes"
|
||
|
else
|
||
|
echo "no"
|
||
|
fi
|
||
|
EOF
|
||
|
|
||
|
execout=$(docker exec -i dummy_service /bin/bash -c "/bin/bash /tmp/send.sh")
|
||
|
[ "$execout" != 'yes' ] && { echo "device-name not created"; exit 1;}
|
||
|
|
||
|
echo ""
|
||
|
echo "done!"
|
||
|
echo ""
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|