install script

This commit is contained in:
justmarvinn 2025-04-19 18:51:01 +02:00
parent d9da2520a5
commit 14dd229abd
3 changed files with 28 additions and 3 deletions

25
install.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# force run from root user
if [[ $EUID -ne 0 ]]; then
exec sudo "$0" "$@"
fi
set -e
apt update
apt install -y ppp curl
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.sh
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/service" > /etc/systemd/system/sim800c.service
chmod +x /etc/init.d/sim800c
systemctl enable sim800c
systemctl start sim800c

2
script
View File

@ -1,6 +1,6 @@
#!/bin/bash
# /etc/init.d/sim800c
# /etc/init.d/sim800c.sh
case "$1" in
start)

View File

@ -7,8 +7,8 @@ After=rc-local.service
[Service]
Type=forking
PIDFile=/run/ppp0.pid
ExecStart=/etc/init.d/sim800c start
ExecStop=/etc/init.d/sim800c stop
ExecStart=/etc/init.d/sim800c.sh start
ExecStop=/etc/init.d/sim800c.sh stop
Restart=on-failure
RestartSec=5s