From d345712e7b06309dab9e6f529bdf2b9a57f41bfe Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 25 Mar 2023 11:49:10 -0400 Subject: [PATCH] Update alpine-esphome-install.sh --- install/alpine-esphome-install.sh | 37 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/install/alpine-esphome-install.sh b/install/alpine-esphome-install.sh index e189e9a2..6a9cecc6 100644 --- a/install/alpine-esphome-install.sh +++ b/install/alpine-esphome-install.sh @@ -26,38 +26,39 @@ msg_info "Installing Alpine-ESPHome" $STD apk add py3-pip $STD pip3 install esphome $STD pip3 install tornado esptool -cat </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