|
|
@ -1,15 +1,36 @@
|
|
|
|
# Name of image
|
|
|
|
# Name of image
|
|
|
|
IMAGE ?= d.xr.to/base
|
|
|
|
IMAGE?=d.xr.to/base
|
|
|
|
# Arch to be used
|
|
|
|
# Arch to be used
|
|
|
|
ARCH ?= x86_64-musl
|
|
|
|
ARCH?=x86_64-musl
|
|
|
|
# Repo root url to be used (/musl will be appended in case of musl based arch)
|
|
|
|
# Repo root url to be used (/musl will be appended in case of musl based arch)
|
|
|
|
REPO_ROOT ?= https://alpha.de.repo.voidlinux.org/current
|
|
|
|
REPO_ROOT?=https://alpha.de.repo.voidlinux.org/current
|
|
|
|
# Absolute repo url
|
|
|
|
# Absolute repo url
|
|
|
|
REPO ?= $(REPO_ROOT)$(if $(findstring musl, $(ARCH)),/musl)
|
|
|
|
REPO?=$(REPO_ROOT)$(if $(findstring musl, $(ARCH)),/musl)
|
|
|
|
|
|
|
|
# Toolbox to be used (toybox, busybox, none or default)
|
|
|
|
|
|
|
|
TOOLBOX?=toybox
|
|
|
|
# Packages to install
|
|
|
|
# Packages to install
|
|
|
|
PACKAGES ?= toybox xbps bash ncurses-base
|
|
|
|
PACKAGES?=xbps bash ncurses-base
|
|
|
|
# Directory where chroot should be build
|
|
|
|
# Directory where chroot should be build
|
|
|
|
BUILDDIR ?= $(PWD)/build
|
|
|
|
BUILDDIR?=$(PWD)/build
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),none)
|
|
|
|
|
|
|
|
VALID_TOOLBOX?=1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),)
|
|
|
|
|
|
|
|
override TOOLBOX=none
|
|
|
|
|
|
|
|
VALID_TOOLBOX?=1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),toybox)
|
|
|
|
|
|
|
|
override PACKAGES += toybox
|
|
|
|
|
|
|
|
VALID_TOOLBOX?=1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),busybox)
|
|
|
|
|
|
|
|
override PACKAGES += busybox
|
|
|
|
|
|
|
|
VALID_TOOLBOX?=1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),default)
|
|
|
|
|
|
|
|
override PACKAGES += findutils coreutils diffutils gawk which sed gzip file grep
|
|
|
|
|
|
|
|
VALID_TOOLBOX?=1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
default: all
|
|
|
|
default: all
|
|
|
|
|
|
|
|
|
|
|
@ -18,10 +39,18 @@ vars:
|
|
|
|
@echo ARCH=$(ARCH)
|
|
|
|
@echo ARCH=$(ARCH)
|
|
|
|
@echo REPO_ROOT=$(REPO_ROOT)
|
|
|
|
@echo REPO_ROOT=$(REPO_ROOT)
|
|
|
|
@echo REPO=$(REPO)
|
|
|
|
@echo REPO=$(REPO)
|
|
|
|
|
|
|
|
@echo TOOLBOX=$(TOOLBOX)
|
|
|
|
|
|
|
|
@echo VALID_TOOLBOX=$(VALID_TOOLBOX)
|
|
|
|
@echo PACKAGES=$(PACKAGES)
|
|
|
|
@echo PACKAGES=$(PACKAGES)
|
|
|
|
@echo BUILDDIR=$(BUILDDIR)
|
|
|
|
@echo BUILDDIR=$(BUILDDIR)
|
|
|
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
ensure-toolbox:
|
|
|
|
|
|
|
|
ifneq ($(VALID_TOOLBOX),1)
|
|
|
|
|
|
|
|
@echo "Please make sure TOOLBOX is none, toybox (default option), busybox or default"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build: ensure-toolbox
|
|
|
|
# Create build directory
|
|
|
|
# Create build directory
|
|
|
|
mkdir $(BUILDDIR)
|
|
|
|
mkdir $(BUILDDIR)
|
|
|
|
# Create keys database directory
|
|
|
|
# Create keys database directory
|
|
|
@ -34,13 +63,27 @@ build:
|
|
|
|
for dir in lib lib32 sbin bin; do [ -e $(BUILDDIR)/$$dir ] || ln -s usr/$$dir $(BUILDDIR)/$$dir; done
|
|
|
|
for dir in lib lib32 sbin bin; do [ -e $(BUILDDIR)/$$dir ] || ln -s usr/$$dir $(BUILDDIR)/$$dir; done
|
|
|
|
ln -s usr/lib $(BUILDDIR)/lib64
|
|
|
|
ln -s usr/lib $(BUILDDIR)/lib64
|
|
|
|
# Create default directories expected by void
|
|
|
|
# Create default directories expected by void
|
|
|
|
for dir in proc sys dev; do [ -d $(BUILDDIR)/$$dir ] || mkdir $(BUILDDIR)/$$dir; done
|
|
|
|
for dir in proc sys dev tmp; do [ -d $(BUILDDIR)/$$dir ] || mkdir $(BUILDDIR)/$$dir; done
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),toybox)
|
|
|
|
# Create toybox symlinks
|
|
|
|
# Create toybox symlinks
|
|
|
|
xbps-uchroot $(BUILDDIR) /bin/toybox | sed 's:\s:\n:g' | grep -v '^$$' | while read i; do [ -e $(BUILDDIR)/usr/bin/$$i ] || ln -s /bin/toybox $(BUILDDIR)/usr/bin/$$i; done
|
|
|
|
xbps-uchroot $(BUILDDIR) /bin/toybox | sed 's:\s:\n:g' | grep -v '^$$' | while read i; do [ -e $(BUILDDIR)/usr/bin/$$i ] || ln -s /bin/toybox $(BUILDDIR)/usr/bin/$$i; done
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TOOLBOX),busybox)
|
|
|
|
|
|
|
|
# Create busybox symlinks
|
|
|
|
|
|
|
|
xbps-uchroot $(BUILDDIR) /bin/busybox -- --list | while read i; do [ -e $(BUILDDIR)/usr/bin/$$i ] || ln -s /bin/busybox $(BUILDDIR)/usr/bin/$$i; done
|
|
|
|
|
|
|
|
endif
|
|
|
|
# Remove xbps cache dir
|
|
|
|
# Remove xbps cache dir
|
|
|
|
rm -rf $(BUILDDIR)/var/cache/xbps
|
|
|
|
rm -rf $(BUILDDIR)/var/cache/xbps
|
|
|
|
# Import custom bashrc
|
|
|
|
# Import custom bashrc
|
|
|
|
cp bashrc.bash $(BUILDDIR)/etc/bash/bashrc.d/docker.sh
|
|
|
|
cp files/bashrc.bash $(BUILDDIR)/etc/bash/bashrc.d/docker.sh
|
|
|
|
|
|
|
|
# Create os-release file
|
|
|
|
|
|
|
|
cp files/os-release $(BUILDDIR)/etc/os-release
|
|
|
|
|
|
|
|
# Create lsb_release file
|
|
|
|
|
|
|
|
cp files/lsb_release $(BUILDDIR)/bin/lsb_release
|
|
|
|
|
|
|
|
chmod +x $(BUILDDIR)/bin/lsb_release
|
|
|
|
|
|
|
|
# Create passwd and group file
|
|
|
|
|
|
|
|
echo 'root:x:0:0:root:/:/bin/bash' >> $(BUILDDIR)/etc/passwd
|
|
|
|
|
|
|
|
echo 'root:x:0:' >> $(BUILDDIR)/etc/group
|
|
|
|
|
|
|
|
|
|
|
|
install: build
|
|
|
|
install: build
|
|
|
|
# Import directory as tar (owned by root) into docker
|
|
|
|
# Import directory as tar (owned by root) into docker
|
|
|
|