Commit 899baa9d authored by Ophélie Gagnard's avatar Ophélie Gagnard

get value from .cfg

parent 80f83ae2
......@@ -4,9 +4,14 @@
source $NEWROOT/etc/rapid.space/get-network.sh
SLAPOS_CFG_FILE="$NEWROOT"/etc/opt/slapos/slapos.cfg
WENDELIN_REFERENCE=$(sed -n '/computer_id = /p' /etc/opt/slapos/slapos.cfg | sed 's/computer_id = \(.*\)/\1/g')
WENDELIN_REFERENCE=$(sed -n '/computer_id = /p' "$SLAPOS_CFG_FILE" | sed 's/computer_id = \(.*\)/\1/g')
WENDELIN_URL=$(sed -n '/master_url = /p' "$SLAPOS_CFG_FILE" | sed 's/master_url = \(.*\)/\1/g')
SLAPOS_KEY_FILE="$NEWROOT"$(sed -n '/key_file = /p' "$SLAPOS_CFG_FILE" | sed 's/key_file = \(.*\)/\1/g')
SLAPOS_CERT_FILE="$NEWROOT"$(sed -n '/cert_file = /p' "$SLAPOS_CFG_FILE" | sed 's/cert_file = \(.*\)/\1/g')
SCAN_FILE=/var/log/metadata_collect.log
sed -i "s|%SCAN_FILE%|$SCAN_FILE|g;s/%WENDELIN_REFERENCE%/$WENDELIN_REFERENCE/g;s/%NEWROOT%/$NEWROOT/g" /etc/flb.conf
sed -i "s|%SCAN_FILE%|$SCAN_FILE|g;s|%WENDELIN_REFERENCE%|$WENDELIN_REFERENCE|g;s|%SLAPOS_KEY_FILE%|$SLAPOS_KEY_FILE|g;s|%SLAPOS_CERT_FILE%|$SLAPOS_CERT_FILE|g;s|%WENDELIN_URL%|$WENDELIN_URL|g" /etc/flb.conf
timestamp_cmd='date +"%Y/%m/%d %H:%M %Z"'
/sbin/fluent-bit -e /etc/libfluentbit_wendelin.so -c /etc/flb.conf &
......
......@@ -40,8 +40,7 @@ apt -y install ./"$FLB_PACKAGE_FILE"
apt -y install ./"$PLG_PACKAGE_FILE"
FLB_CONF_PATH="/opt/${PLG_PACKAGE_NAME}/etc"
CONF_REGEX="s|%WENDELIN_URL%|${WENDELIN_URL}|g;s|%WENDELIN_PWD%|${WENDELIN_PWD}|g"
sed "$CONF_REGEX" "${FLB_CONF_PATH}/flb.conf.in" > "${FLB_CONF_PATH}/flb.conf"
cp "${FLB_CONF_PATH}/flb.conf.in" "${FLB_CONF_PATH}/flb.conf"
echo "Created ${FLB_CONF_PATH}/flb.conf from template ${FLB_CONF_PATH}/flb.conf.in"
echo -e "\nDependencies successfully installed!\n"
......@@ -6,9 +6,6 @@
required_variables="
CERT_NAME
SERVER_GROUP
WENDELIN_URL
WENDELIN_USER
WENDELIN_PWD
"
for variable in $required_variables; do
if [ ! -v "$variable" ]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment