forked from oofnikj/docker-openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (36 loc) · 1.27 KB
/
Makefile
File metadata and controls
45 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.PHONY: build build-rpi run clean install uninstall
include openwrt.conf
export
ifeq (${OPENWRT_SOURCE_VER}, snapshot)
ROOTFS_URL=https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-rootfs.tar.gz
else
ROOTFS_URL=https://downloads.openwrt.org/releases/${OPENWRT_SOURCE_VER}/targets/x86/64/openwrt-${OPENWRT_SOURCE_VER}-x86-64-generic-rootfs.tar.gz
endif
rootfs.tar.gz:
wget ${ROOTFS_URL} -O rootfs.tar.gz
build: rootfs.tar.gz
docker build \
--build-arg ts="$(shell date)" \
--build-arg version="${OPENWRT_SOURCE_VER}" \
-t ${IMAGE_TAG} .
rm rootfs.tar.gz
build-rpi:
./build-rpi.sh ${RPI_SOURCE_IMG}
run:
./run.sh
clean:
docker stop ${CONTAINER} || true
docker rm ${CONTAINER} || true
docker network rm ${LAN_NAME} ${WAN_NAME} || true
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