- fix setup script

This commit is contained in:
Dmytro Bogovych 2023-08-10 10:08:06 +03:00
parent b814b54acb
commit f1071a4040
1 changed files with 8 additions and 7 deletions

View File

@ -23,35 +23,36 @@ cd $INSTALL_DIR
BACKEND_URL=""
PHONE_NAME=""
TASK_NAME=""
read -p "Please specify backend URL (ex: https://q.sevana.biz ): " BACKEND_URL
read -p "Please specify backend URL (ex: https://gsm.sevana.biz ): " BACKEND_URL
read -p "Please specify phone name (ex: moto_1): " PHONE_NAME
read -p "Please specify expected task name (if this is answerer phone):" TASK_NAME
read -p "Please specify expected task name (if this is answerer phone): " TASK_NAME
# Get a copy of config file from redist
cp config/agent.in.yaml config/agent.yaml
# Replace the values
if [[ $BACKEND_URL != "" ]]; then
sed -i "s/BACKEND_URL/$BACKEND_URL/" config/agent.yaml
sed -i "s|BACKEND_URL|$BACKEND_URL|" config/agent.yaml
fi
if [[ $PHONE_NAME != "" ]]; then
sed -i "s/PHONE_NAME/$PHONE_NAME/" config/agent.yaml
sed -i "s|PHONE_NAME|$PHONE_NAME|" config/agent.yaml
fi
sed -i "s/TASK_NAME/$TASK_NAME/" config/agent.yaml
sed -i "s|TASK_NAME|$TASK_NAME|" config/agent.yaml
# Update systemD unit file
cp config/systemd/agent_gsm.in.service config/systemd/agent_gsm.service
ABSOLUTE_INSTALL_DIR=`realpath $INSTALL_DIR`
ABSOLUTE_INSTALL_DIR=`realpath .`
sed -i "s/ABSOLUTE_INSTALL_DIR/$ABSOLUTE_INSTALL_DIR/" config/systemd/agent_gsm.service
sed -i "s|ABSOLUTE_INSTALL_DIR|$ABSOLUTE_INSTALL_DIR|" config/systemd/agent_gsm.service
echo "Now the remaining prerequisites will be installed and system will reboot."
echo "You can connect the phone via Bluetooth after the reboot."
echo "Use the connect_phone.sh to ease the connection process. This script will ask you about Bluetooth MAC address and make attempt to pair & connect the phone. "
echo "Please run $INSTALL_DIR/run_node.sh to see if everything works ok."
echo "After you can use $INSTALL_DIR/config/systemd/agent_gsm.service to enable this work with systemD."
echo ""
# Run bootstrap app
./pi_bootstrap_bt.sh