Update alpine-esphome-install.sh

correct openrc
This commit is contained in:
tteckster 2023-03-25 14:57:42 -04:00 committed by GitHub
parent 86ec03dc35
commit 642048fb6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,38 +27,21 @@ $STD apk add py3-pip
$STD pip3 install esphome
$STD pip3 install tornado esptool
service_path="/etc/init.d/esphome"
echo "#!/sbin/openrc-run
name=\"esphome\"
description=\"ESPHome Dashboard\"
command=\"/usr/bin/esphome /root/config/ dashboard\"
command_user=\"root\"
command_background=true
pidfile=\"/run/\$name.pid\"
depend() {
need net
}
start_pre() {
checkpath --directory --mode 0755 /run/\$name
}
description=\"ESPHome\"
pidfile=\"/run/esphome.pid\"
start() {
ebegin \"Starting \$description\"
start-stop-daemon --start --quiet --background --exec /usr/bin/esphome -- /root/config/ dashboard
eend \$?
esphome dashboard /root/esphome/config/ > /dev/null 2>&1 &
echo \$! > \$pidfile
}
stop() {
ebegin \"Stopping \$description\"
pkill esphome
eend \$?
}" > $service_path
kill \$(cat \$pidfile)
rm \$pidfile
}" > /etc/init.d/esphome
chmod 755 $service_path
$STD rc-update add esphome default
$STD /etc/init.d/esphome start
chmod 755 /etc/init.d/esphome
rc-service -q esphome start
rc-update add -q esphome default
msg_ok "Installed Alpine-ESPHome"
motd_ssh