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.
33 lines
597 B
33 lines
597 B
10 years ago
|
#!/bin/bash
|
||
|
|
||
|
ENV_FILE="/tmp/one_env"
|
||
|
|
||
|
TOKENTXT=$(cat /mnt/token.txt)
|
||
9 years ago
|
|
||
|
if [ -n "$ONEGATE_TOKEN" ]; then
|
||
|
TOKENTXT="$ONEGATE_TOKEN"
|
||
|
fi
|
||
|
|
||
10 years ago
|
echo "export TOKENTXT=\"$TOKENTXT\"" > $ENV_FILE
|
||
9 years ago
|
echo "export VMID=\"$VMID\"" >> $ENV_FILE
|
||
|
echo "export ONEGATE_ENDPOINT=\"$ONEGATE_ENDPOINT\"" >> $ENV_FILE
|
||
10 years ago
|
|
||
|
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
|
||
|
}
|
||
|
|
||
9 years ago
|
export_rc_vars /tmp/context.sh
|
||
10 years ago
|
|
||
|
chown root:root $ENV_FILE
|
||
10 years ago
|
chmod a+r $ENV_FILE
|
||
10 years ago
|
|