Update alpine-esphome-install.sh

This commit is contained in:
tteckster 2023-03-25 11:49:10 -04:00 committed by GitHub
parent 18af21a1cc
commit d345712e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,38 +26,39 @@ msg_info "Installing Alpine-ESPHome"
$STD apk add py3-pip
$STD pip3 install esphome
$STD pip3 install tornado esptool
cat <<EOF >/etc/init.d/esphome
#!/sbin/openrc-run
name="esphome"
description="ESPHome Service"
command="/usr/bin/esphome /root/config/ dashboard"
pidfile="/run/esphome/pid"
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/esphome
checkpath --directory --mode 0755 /run/\$name
}
start() {
ebegin "Starting $description"
start-stop-daemon --start --quiet --exec $command
eend $?
ebegin \"Starting \$description\"
start-stop-daemon --start --quiet --background --exec /usr/bin/esphome -- /root/config/ dashboard
eend \$?
}
stop() {
ebegin "Stopping $description"
start-stop-daemon --stop --quiet --exec $command
eend $?
}
EOF
ebegin \"Stopping \$description\"
pkill esphome
eend \$?
}" > $service_path
chmod 755 /etc/init.d/esphome
/etc/init.d/esphome start
rc-update add esphome default
chmod 755 $service_path
$STD rc-update add esphome default
$STD /etc/init.d/esphome start
msg_ok "Installed Alpine-ESPHome"
motd_ssh