From 0afc2ce276a0f57588dd00a5305f7bd9e6471498 Mon Sep 17 00:00:00 2001 From: Santiago Torres Date: Tue, 17 Apr 2018 20:05:57 -0400 Subject: [PATCH] ENH: update root-less build This commit adds: - Systemd sysusers hook is ran on the dockerfile - The dockerfile also populates the archlinux keyring - Remove the libalpm hooks as they are uneccessary now - Moved the package cleanup before the tar step on the makefile --- Dockerfile | 1 + Makefile | 12 ++++++++---- rootfs/usr/share/libalpm/hooks/package-cleanup.hook | 11 ----------- 3 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 rootfs/usr/share/libalpm/hooks/package-cleanup.hook diff --git a/Dockerfile b/Dockerfile index 8e684d0..a09622b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,5 +3,6 @@ ADD archlinux.tar / RUN update-ca-certs RUN locale-gen RUN pacman-key --init && pacman-key --populate archlinux +RUN /usr/share/libalpm/scripts/systemd-hook sysusers ENV LANG=en_US.UTF-8 CMD ["/usr/bin/bash"] diff --git a/Makefile b/Makefile index aee8e83..0e50cd5 100644 --- a/Makefile +++ b/Makefile @@ -3,17 +3,21 @@ DOCKER_ORGANIZATION=archlinux DOCKER_IMAGE:=base BUILDDIR=build -rootfs: +hooks: + mkdir -p alpm-hooks/usr/share/libalpm/hooks + find /usr/share/libalpm/hooks -exec ln -s /dev/null $(PWD)/alpm-hooks{} \; + +rootfs: hooks mkdir -vp $(BUILDDIR)/var/lib/pacman/ - fakechroot -- fakeroot -- pacman -Syu -r $(BUILDDIR) \ + fakechroot -- fakeroot -- pacman -Sy -r $(BUILDDIR) \ --noconfirm --dbpath $(PWD)/$(BUILDDIR)/var/lib/pacman \ --config rootfs/etc/pacman.conf \ --noscriptlet \ - --hookdir $(PWD)/rootfs/usr/share/libalpm/hooks/ $(shell cat packages) + --hookdir $(PWD)/alpm-hooks/usr/share/libalpm/hooks/ $(shell cat packages) cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(BUILDDIR)/ rm -r build/var/cache/pacman/pkg tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f archlinux.tar - rm -rf $(BUILDDIR) + rm -rf $(BUILDDIR) alpm-hooks docker-image: rootfs docker build -t $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) . diff --git a/rootfs/usr/share/libalpm/hooks/package-cleanup.hook b/rootfs/usr/share/libalpm/hooks/package-cleanup.hook deleted file mode 100644 index 448d871..0000000 --- a/rootfs/usr/share/libalpm/hooks/package-cleanup.hook +++ /dev/null @@ -1,11 +0,0 @@ -[Trigger] -Operation = Install -Operation = Upgrade -Type = Package -Target = * - -[Action] -Description = Cleaning up package cache... -Depends = coreutils -When = PostTransaction -Exec = /usr/bin/rm -rf /var/cache/pacman/pkg