-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
35 lines (28 loc) · 1.4 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
IMAGE_NAME := picore
IMAGE_TAG := 7.0-armv7
TMP_IMAGE_NAME := $(IMAGE_NAME)-tar-builder
TMP_CONTAINER_NAME := $(IMAGE_NAME)-tar-exporter
.PHONY: all build stop clean
all: build
build: 7.0v7.tgz
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) .
7.0v7.tgz: squashfs-tools.tar.gz
docker run -d --privileged -v $(shell pwd)/src:/tmp --name $(TMP_CONTAINER_NAME) hypriot/armhf-busybox sleep 180
docker start $(TMP_CONTAINER_NAME)
docker exec -i $(TMP_CONTAINER_NAME) /bin/sh -c /tmp/build_7.0v7.sh
mv src/7.0v7.tgz .
docker kill $(TMP_CONTAINER_NAME)
docker rm $(TMP_CONTAINER_NAME)
squashfs-tools.tar.gz:
docker run -d --privileged --name $(TMP_CONTAINER_NAME) hypriot/armhf-busybox sleep 180
docker start $(TMP_CONTAINER_NAME)
docker exec -i $(TMP_CONTAINER_NAME) /bin/sh -c 'cat > /tmp/build_squashfs_tools.sh; /bin/sh /tmp/build_squashfs_tools.sh' < src/build_squashfs_tools.sh > squashfs-tools.tar.gz
docker exec $(TMP_CONTAINER_NAME) umount /mnt
docker kill $(TMP_CONTAINER_NAME)
docker rm $(TMP_CONTAINER_NAME)
clean:
docker ps | grep -q $(TMP_CONTAINER_NAME) && docker stop $(TMP_CONTAINER_NAME) || true
docker ps -a | grep -q $(TMP_CONTAINER_NAME) && docker rm $(TMP_CONTAINER_NAME) || true
docker images $(IMAGE_NAME) | grep -q $(IMAGE_TAG) && docker rmi $(IMAGE_NAME):$(IMAGE_TAG) || true
docker images | grep -q $(TMP_IMAGE_NAME) && docker rmi $(TMP_IMAGE_NAME) || true
rm -f squashfs-tools.tar.gz 7.0v7.tgz