add install and uninstall targets for systemctl
parent
87301e1c10
commit
4cc98935b0
18
Makefile
18
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: build run clean
|
||||
.PHONY: build run clean install uninstall
|
||||
|
||||
include openwrt.conf
|
||||
|
||||
|
@ -11,4 +11,18 @@ run:
|
|||
clean:
|
||||
docker rm ${CONTAINER} || true
|
||||
docker network rm ${LAN_NAME} ${WAN_NAME} || true
|
||||
docker rmi ${BUILD_TAG}
|
||||
docker rmi ${BUILD_TAG}
|
||||
|
||||
install:
|
||||
install -Dm644 openwrt.service /usr/lib/systemd/system/openwrt.service
|
||||
sed -i -E "s#(ExecStart=).*#\1`pwd`/run.sh#g" /usr/lib/systemd/system/openwrt.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable openwrt.service
|
||||
@echo "OpenWRT service installed and will be started on next boot automatically."
|
||||
@echo "To start it now, run 'systemctl start openwrt.service'."
|
||||
|
||||
uninstall:
|
||||
systemctl stop openwrt.service
|
||||
systemctl disable openwrt.service
|
||||
rm /usr/lib/systemd/system/openwrt.service
|
||||
systemctl daemon-reload
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description="OpenWRT"
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=
|
||||
|
||||
[Install]
|
||||
WantedBy=network-online.target
|
Loading…
Reference in New Issue