- initial import
This commit is contained in:
54
setup/setup_agent_gsm.sh
Executable file
54
setup/setup_agent_gsm.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installation directory
|
||||
INSTALL_DIR=agent_gsm
|
||||
|
||||
# Re
|
||||
GIT_SOURCE=https://deploy:deploy@git.sevana.biz/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
|
||||
|
||||
# Run bootstrap app
|
||||
./pi_bootstrap_bt.sh
|
||||
|
||||
# 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 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.
|
||||
Reference in New Issue
Block a user