-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
77 lines (65 loc) · 2.13 KB
/
Makefile
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
ALL_VERSIONS := 10.03 10.03.1 12.09 14.07 15.05
ALL_ARCHS := x86 x64
LATEST_VERSION := 15.05
VERSION ?= 15.05
ARCH ?= x86
TAG := $(VERSION)-$(ARCH)
ifeq ($(VERSION),latest)
TAG := $(LATEST_VERSION)-$(ARCH)
endif
# VERSIONS
ifeq ($(TAG),15.05-x64)
ROOTFS_URL := https://downloads.openwrt.org/chaos_calmer/15.05/x86/64/openwrt-15.05-x86-64-rootfs.tar.gz
endif
ifeq ($(TAG),15.05-x86)
ROOTFS_URL := https://downloads.openwrt.org/chaos_calmer/15.05/x86/generic/openwrt-15.05-x86-generic-Generic-rootfs.tar.gz
endif
ifeq ($(TAG),14.07-x86)
ROOTFS_URL := https://downloads.openwrt.org/barrier_breaker/14.07/x86/generic/openwrt-x86-generic-Generic-rootfs.tar.gz
endif
ifeq ($(TAG),12.09-x86)
ROOTFS_URL := https://downloads.openwrt.org/attitude_adjustment/12.09/x86/generic/openwrt-x86-generic-rootfs.tar.gz
endif
ifeq ($(TAG),10.03.1-x86)
ROOTFS_URL := https://downloads.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-rootfs.tar.gz
endif
ifeq ($(TAG),10.03-x86)
ROOTFS_URL := https://downloads.openwrt.org/backfire/10.03/x86/openwrt-x86-rootfs.tgz
endif
ifeq ($(VERSION),latest)
VERSION := $(LATEST_VERSION)
TAG := latest-$(ARCH)
endif
run: build
@docker run --rm -ti cusspvz/openwrt:${TAG}
run-bash: build
@docker run --rm -ti cusspvz/openwrt:${TAG} /bin/bash
pull-root:
@if [ "${ROOTFS_URL}" == "" ]; then echo "No ROOTFS available"; exit 1; fi
@docker images | grep openwrt-${TAG} || docker import ${ROOTFS_URL} openwrt-${TAG}
pull-root-forced:
@if [ "${ROOTFS_URL}" == "" ]; then echo "No ROOTFS available"; exit 1; fi
@echo "Pulling $(TAG)"
docker import ${ROOTFS_URL} openwrt-${TAG}
build: pull-root
@echo "Building ${TAG}"
@echo FROM openwrt-${TAG} > Dockerfile.tmp
@cat Dockerfile >> Dockerfile.tmp
@-docker build -t cusspvz/openwrt:${TAG} -f Dockerfile.tmp .
@rm Dockerfile.tmp
push: pull-root build
@docker push cusspvz/openwrt:${TAG}
build-all:
for ARCH in ${ALL_ARCHS}; do \
for VERSION in ${ALL_VERSIONS}; do \
make build; \
done; \
make VERSION="latest" build; \
done;
push-all:
for ARCH in ${ALL_ARCHS}; do \
for VERSION in ${ALL_VERSIONS}; do \
make push; \
done; \
make VERSION="latest" push; \
done;