Add user files

This commit is contained in:
eater 2018-12-20 23:04:32 +01:00
parent bc3fd88bf6
commit cd07a563f8
Signed by: eater
GPG key ID: 656785D50BE51C0A
4 changed files with 13 additions and 5 deletions

View file

@ -10,7 +10,7 @@ REPO?=$(REPO_ROOT)$(if $(findstring musl, $(ARCH)),/musl)
# Toolbox to be used (toybox, busybox, none or default)
TOOLBOX?=toybox
# Packages to install
PACKAGES?=xbps bash ncurses-base
PACKAGES?=xbps bash ncurses-base shadow
# Directory where chroot should be build
BUILDDIR?=$(PWD)/build
ifeq ($(TOOLBOX),none)
@ -65,7 +65,7 @@ build: ensure-toolbox
for dir in lib lib32 sbin bin; do [ -e $(BUILDDIR)/$$dir ] || ln -s usr/$$dir $(BUILDDIR)/$$dir; done
ln -s usr/lib $(BUILDDIR)/lib64
# Create default directories expected by void
for dir in proc sys dev tmp; do [ -d $(BUILDDIR)/$$dir ] || mkdir $(BUILDDIR)/$$dir; done
for dir in proc sys dev tmp run; do [ -d $(BUILDDIR)/$$dir ] || mkdir $(BUILDDIR)/$$dir; done
ifeq ($(TOOLBOX),toybox)
# 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
@ -83,9 +83,10 @@ endif
# 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
# Create passwd, shadow and group file
cp files/passwd $(BUILDDIR)/etc/passwd
cp files/group $(BUILDDIR)/etc/group
cp files/shadow $(BUILDDIR)/etc/shadow
install: build
# Import directory as tar (owned by root) into docker

3
files/group Normal file
View file

@ -0,0 +1,3 @@
root:x:0:
nogroup:x:99:
users:x:100:

2
files/passwd Normal file
View file

@ -0,0 +1,2 @@
root:x:0:0:root:/:/bin/bash
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false

2
files/shadow Normal file
View file

@ -0,0 +1,2 @@
root:x::0:99999:7:::
nobody:x::0:99999:7:::