Add script to generate environment file in /tmp/one_env

Based in the script made by Daniel Molina <dmolina@opennebula.org>:

5ce7c87cc8/share/onegate/init.sh
pull/15/head
Javi Fontan 10 years ago
parent 42e56c9246
commit 644d1f12e3

@ -0,0 +1,25 @@
#!/bin/bash
ENV_FILE="/tmp/one_env"
TOKENTXT=$(cat /mnt/token.txt)
echo "export TOKENTXT=\"$TOKENTXT\"" > $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 /mnt/context.sh
chown root:root $ENV_FILE
chmod 400 $ENV_FILE
Loading…
Cancel
Save