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