2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 02:52:07 +00:00
confluent/confluent_osdeploy/el7/profiles/default/scripts/functions

39 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-07-23 16:29:43 +00:00
run_remote() {
requestedcmd="'$*'"
echo
echo '---------------------------------------------------------------------------'
echo Running $requestedcmd from https://$mgr/confluent-public/os/$profile/scripts/
tmpdir=$(mktemp -d)
echo Executing in $tmpdir
cd $tmpdir
curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1
if [ $? != 0 ]; then echo $requestedcmd failed to download; return 1; fi
2020-07-23 16:29:43 +00:00
chmod +x $1
cmd=$1
2020-07-24 20:07:15 +00:00
if [ -x /usr/bin/chcon ]; then
chcon system_u:object_r:bin_t:s0 $cmd
fi
2020-07-23 16:29:43 +00:00
shift
./$cmd $*
retcode=$?
echo "$requestedcmd exited with code $retcode"
cd - > /dev/null
return $retcode
2020-07-23 16:29:43 +00:00
}
run_remote_python() {
echo
echo '---------------------------------------------------------------------------'
echo Running python script "'$*'" from https://$mgr/confluent-public/os/$profile/scripts/
tmpdir=$(mktemp -d)
echo Executing in $tmpdir
cd $tmpdir
curl -f -sS https://$mgr/confluent-public/os/$profile/scripts/$1 > $1
if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi
2020-07-23 16:29:43 +00:00
/usr/libexec/platform-python $*
retcode=$?
echo "'$*' exited with code $retcode"
cd - > /dev/null
return $retcode
2020-07-23 16:29:43 +00:00
}