2019-10-10 00:52:42 -04:00
#!/bin/bash
user_id = ` id -u`
# we want to snapshot the environment of the config user
2019-12-16 11:27:46 -05:00
if [ $user_id -eq 0 -a -z " $RUNNER_ALLOW_RUNASROOT " ] ; then
2019-10-10 00:52:42 -04:00
echo "Must not run with sudo"
exit 1
fi
2021-01-21 13:45:16 -05:00
# Check dotnet core 3.0 dependencies for Linux
2019-10-10 00:52:42 -04:00
if [ [ ( ` uname` = = "Linux" ) ] ]
then
command -v ldd > /dev/null
if [ $? -ne 0 ]
then
echo "Can not find 'ldd'. Please install 'ldd' and try again."
exit 1
fi
2021-01-21 13:45:16 -05:00
message = "Execute sudo ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies."
2020-11-03 11:38:35 +09:00
2019-10-10 00:52:42 -04:00
ldd ./bin/libcoreclr.so | grep 'not found'
if [ $? -eq 0 ] ; then
2021-01-21 13:45:16 -05:00
echo "Dependencies is missing for Dotnet Core 3.0"
2020-11-03 11:38:35 +09:00
echo $message
2019-10-10 00:52:42 -04:00
exit 1
fi
2021-01-21 13:45:16 -05:00
ldd ./bin/System.Security.Cryptography.Native.OpenSsl.so | grep 'not found'
2019-10-10 00:52:42 -04:00
if [ $? -eq 0 ] ; then
2021-01-21 13:45:16 -05:00
echo "Dependencies is missing for Dotnet Core 3.0"
2020-11-03 11:38:35 +09:00
echo $message
2019-10-10 00:52:42 -04:00
exit 1
fi
2021-01-21 13:45:16 -05:00
ldd ./bin/System.IO.Compression.Native.so | grep 'not found'
2019-10-10 00:52:42 -04:00
if [ $? -eq 0 ] ; then
2021-01-21 13:45:16 -05:00
echo "Dependencies is missing for Dotnet Core 3.0"
2020-11-03 11:38:35 +09:00
echo $message
2019-10-10 00:52:42 -04:00
exit 1
fi
if ! [ -x " $( command -v ldconfig) " ] ; then
LDCONFIG_COMMAND = "/sbin/ldconfig"
if ! [ -x " $LDCONFIG_COMMAND " ] ; then
echo "Can not find 'ldconfig' in PATH and '/sbin/ldconfig' doesn't exists either. Please install 'ldconfig' and try again."
exit 1
fi
else
LDCONFIG_COMMAND = "ldconfig"
fi
libpath = ${ LD_LIBRARY_PATH :- }
2020-10-27 13:14:17 +10:00
$LDCONFIG_COMMAND -NXv ${ libpath // : / } 2>& 1 | grep libicu >/dev/null 2>& 1
2019-10-10 00:52:42 -04:00
if [ $? -ne 0 ] ; then
2021-01-21 13:45:16 -05:00
echo "Libicu's dependencies is missing for Dotnet Core 3.0"
2020-11-03 11:38:35 +09:00
echo $message
2019-10-10 00:52:42 -04:00
exit 1
fi
fi
# Change directory to the script root directory
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
SOURCE = " ${ BASH_SOURCE [0] } "
while [ -h " $SOURCE " ] ; do # resolve $SOURCE until the file is no longer a symlink
DIR = " $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
SOURCE = " $( readlink " $SOURCE " ) "
[ [ $SOURCE != /* ] ] && SOURCE = " $DIR / $SOURCE " # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR = " $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
2020-07-20 10:19:37 -04:00
cd " $DIR "
2019-10-10 00:52:42 -04:00
source ./env.sh
shopt -s nocasematch
if [ [ " $1 " = = "remove" ] ] ; then
./bin/Runner.Listener " $@ "
else
./bin/Runner.Listener configure " $@ "
fi