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.
addon-context-linux/base/etc/one-context.d/16-gen-env

33 lines
597 B

#!/bin/bash
ENV_FILE="/tmp/one_env"
TOKENTXT=$(cat /mnt/token.txt)
if [ -n "$ONEGATE_TOKEN" ]; then
TOKENTXT="$ONEGATE_TOKEN"
fi
echo "export TOKENTXT=\"$TOKENTXT\"" > $ENV_FILE
echo "export VMID=\"$VMID\"" >> $ENV_FILE
echo "export ONEGATE_ENDPOINT=\"$ONEGATE_ENDPOINT\"" >> $ENV_FILE
function export_rc_vars
{
if [ -f $1 ] ; then
ONE_VARS=$(cat $1 | egrep -e '^[a-zA-Z\-\_0-9]*=' | sed 's/=.*$//')
. $1
for v in $ONE_VARS; do
echo "export $v=\"${!v}\"" >> $ENV_FILE
done
fi
}
export_rc_vars /tmp/context.sh
chown root:root $ENV_FILE
chmod a+r $ENV_FILE