SIM800C/install.sh
2025-04-22 22:03:43 +02:00

31 lines
1.1 KiB
Bash

#!/bin/bash
# force run from root user
if [[ $EUID -ne 0 ]]; then
exec sudo "$0" "$@"
fi
set -e
apt update
apt remove -y inetutils-ping
apt install -y ppp curl iputils-ping
mkdir -p /etc/ppp/chatscripts
mkdir -p /etc/ppp/peers
mkdir -p /etc/init.d
mkdir -p /etc/systemd/system
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/chat" > /etc/ppp/chatscripts/sim800c
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/peer" > /etc/ppp/peers/sim800c
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/script" > /etc/init.d/sim800c
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/service" > /etc/systemd/system/sim800.service
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/healthcheck-service" > /etc/systemd/system/sim800-healthcheck.service
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/healthcheck-timer" > /etc/systemd/system/sim800-healthcheck.timer
chmod +x /etc/init.d/sim800c
systemctl enable sim800
systemctl start sim800
systemctl enable sim800-healthcheck
systemctl start sim800-healthcheck