#!/bin/bash # Installation directory INSTALL_DIR=agent_gsm # Re GIT_SOURCE=https://git.sevana.biz/public/agent_gsm_redist # Install prerequisites sudo apt install git mc python3 sox vim if [ -f "$INSTALL_DIR" ]; then rm -rf "$INSTALL_DIR" fi # Anonymous cloning git clone $GIT_SOURCE $INSTALL_DIR # Go to cloned directory cd $INSTALL_DIR # Update config file BACKEND_URL="" PHONE_NAME="" TASK_NAME="" read -p "Please specify backend URL (ex: https://q.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 # Get a copy of config file from redist cp config/agent.in.yaml config/config.yaml # Replace the values if [[ $BACKEND_URL != "" ]]; then sed -i "s/BACKEND_URL/$BACKEND_URL/" config/config.yaml fi if [[ $PHONE_NAME != "" ]]; then sed -i "s/PHONE_NAME/$PHONE_NAME/" config/config.yaml fi sed -i "s/TASK_NAME/$TASK_NAME/" config/config.yaml # Update systemD unit file cp config/systemd/agent_gsm.in.service config/systemd/agent_gsm.service ABSOLUTE_INSTALL_DIR=`realpath $INSTALL_DIR` 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." # Run bootstrap app ./pi_bootstrap_bt.sh