-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
88 additions
and
206 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ISO_NAME=archlinux-cloud | ||
ISO_LABEL=ARCH_DEVELOP | ||
ISO_VERSION=develop | ||
|
||
OUT_DIR=/mnt/out |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
.env | ||
/out | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,28 @@ | ||
PRINT = @echo -e "\e[1;34m"$(1)"\e[0m" | ||
export ISO_NAME := archlinux-cloud | ||
export ISO_LABEL := ARCH_$(shell date +%Y%m) | ||
export ISO_VERSION := $(shell date +%Y.%m.%d) | ||
|
||
BUILD_DIR := build | ||
TEST_DIR := test | ||
OUT_DIR := out | ||
|
||
export CONTAINER_BUILD_DIR := /mnt/build | ||
export CONTAINER_TEST_DIR := /mnt/test | ||
export CONTAINER_OUT_DIR := /mnt/out | ||
|
||
CONTAINER_RUN = docker run \ | ||
-e BUILD_DIR=$(CONTAINER_BUILD_DIR) \ | ||
-e TEST_DIR=$(CONTAINER_TEST_DIR) \ | ||
-e OUT_DIR=$(CONTAINER_OUT_DIR) \ | ||
-e PUID=$(shell id -u) \ | ||
-e PGID=$(shell id -g) \ | ||
-e PUSER=$(1) \ | ||
--env-file=$(abspath $(DOTENV)) \ | ||
-i \ | ||
--privileged \ | ||
--rm \ | ||
-t \ | ||
--tmpfs=/run/shm \ | ||
--tmpfs=/tmp:exec \ | ||
-v "$(abspath $(2)):$(3)" \ | ||
-v "$(abspath $(OUT_DIR)):$(CONTAINER_OUT_DIR)" \ | ||
-w "$(3)" \ | ||
$(call CONTAINER_IMAGE,$(1)) | ||
|
||
INIT_FILES := | ||
CLEAN_FILES := $(OUT_DIR) | ||
|
||
include *.mk | ||
DIST_ISO := dist/$(ISO_NAME)-$(ISO_VERSION)-x86_64.iso | ||
|
||
.DEFAULT_GOAL := all | ||
.PHONY: all | ||
all: init build | ||
|
||
.PHON: init | ||
init: $(INIT_FILES) | ||
all: build test dist | ||
|
||
.PHONY: build | ||
build: build/all | ||
|
||
.PHONY: build/% | ||
build/%: build-container $(OUT_DIR) | ||
$(call PRINT,Starting build container...) | ||
$(call CONTAINER_RUN,build,$(BUILD_DIR),$(CONTAINER_BUILD_DIR)) make $(MAKEFLAGS) $* | ||
$(call PRINT,Stopped build container) | ||
build: | ||
docker-compose run --rm build sh -c 'sudo chmod 777 $${OUT_DIR} && make' | ||
|
||
.PHONY: test | ||
test: test/all | ||
|
||
.PHONY: test/% | ||
test/%: test-container $(OUT_DIR) | ||
$(call PRINT,Starting test container...) | ||
$(call CONTAINER_RUN,test,$(TEST_DIR),$(CONTAINER_TEST_DIR)) make $(MAKEFLAGS) $* | ||
$(call PRINT,Stopped test container) | ||
test: | ||
docker-compose run --rm test make | ||
|
||
$(OUT_DIR): | ||
$(call PRINT,'Creating directory "$@"...') | ||
mkdir -p $(@) | ||
.PHONY: dist | ||
dist: | ||
mkdir -p $(dir $(DIST_ISO)) | ||
docker-compose run --rm build sh -c 'cat $${OUT_DIR}/$(notdir $(DIST_ISO))' > $(DIST_ISO).tmp | ||
mv -f $(DIST_ISO).tmp $(DIST_ISO) | ||
|
||
.PHONY: clean | ||
clean: | ||
$(call PRINT,Cleaning...) | ||
docker run \ | ||
--rm \ | ||
-v "$(abspath .):/mnt" \ | ||
-w /mnt \ | ||
archlinux \ | ||
rm -rf $(CLEAN_FILES) | ||
rm -rf $(dir $(DIST_ISO)) | ||
docker-compose down --rmi local -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,7 @@ | ||
PRINT = @echo -e "\e[1;34m"[build] $(1)"\e[0m" | ||
|
||
CLEAN_FILES := | ||
|
||
include *.mk | ||
|
||
.DEFAULT_GOAL := all | ||
.PHONY: all | ||
all: iso | ||
|
||
.PHONY: clean | ||
clean: | ||
sudo rm -rf $(CLEAN_FILES) | ||
|
||
.PHONY: exec | ||
exec: | ||
bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
export OUT_ISO_WORK_DIR := $(OUT_DIR)/iso.work | ||
export OUT_ISO := $(OUT_ISO_DIR)/$(ISO_NAME)-$(ISO_VERSION)-x86_64.iso | ||
|
||
CLEAN_FILES += \ | ||
$(OUT_ISO_WORK_DIR) \ | ||
$(OUT_ISO) | ||
OUT_ISO := $(OUT_DIR)/$(ISO_NAME)-$(ISO_VERSION)-x86_64.iso | ||
OUT_ISO_WORK_DIR := $(OUT_DIR)/iso | ||
|
||
.PHONY: iso | ||
iso: $(OUT_ISO) | ||
|
||
$(OUT_ISO): profile repo | ||
$(call PRINT,Building ISO image...) | ||
sudo mkarchiso \ | ||
-o $(OUT_ISO_DIR) \ | ||
-o $(OUT_DIR) \ | ||
-v \ | ||
-w $(OUT_ISO_WORK_DIR) \ | ||
$(OUT_PROFILE_DIR) | ||
$(call PRINT,Succeessfully built ISO image) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3' | ||
services: | ||
build: | ||
build: ./build | ||
environment: | ||
BUILD_DIR: /mnt/build | ||
ISO_LABEL: ${ISO_LABEL} | ||
ISO_NAME: ${ISO_NAME} | ||
ISO_VERSION: ${ISO_VERSION} | ||
env_file: .env | ||
privileged: true | ||
volumes: | ||
- ./build:/mnt/build:rw | ||
- out:/mnt/out:rw | ||
working_dir: /mnt/build | ||
test: | ||
build: ./test | ||
environment: | ||
ISO_LABEL: ${ISO_LABEL} | ||
ISO_NAME: ${ISO_NAME} | ||
ISO_VERSION: ${ISO_VERSION} | ||
TEST_DIR: /mnt/test | ||
env_file: .env | ||
privileged: true | ||
volumes: | ||
- ./test:/mnt/test:ro | ||
- out:/mnt/out:rw | ||
working_dir: /mnt/test | ||
volumes: | ||
out: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.