Skip to content

Commit

Permalink
build: change build process to be closer to arch
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Venz <[email protected]>
  • Loading branch information
ikstream committed May 6, 2024
1 parent 3e4bcea commit 376f3f2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo pacman-key --init && \
sudo pacman-key --populate archlinux blackarch && \
sudo pacman -Sy --noconfirm --needed archlinux-keyring blackarch-keyring && \
sudo pacman -Sy --noconfirm --needed make docker devtools fakeroot fakechroot
sudo pacman -S --noconfirm --needed make docker devtools fakeroot fakechroot
- name: Build base
run: |
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ define rootfs
install -Dm644 /usr/share/devtools/pacman.conf.d/extra.conf $(BUILDDIR)/etc/pacman.conf
cat pacman-conf.d-blackarch.conf >> $(BUILDDIR)/etc/pacman.conf

fakechroot -- fakeroot -- pacman -Syu -r $(BUILDDIR) --needed \
sed 's/Include = /&rootfs/g' < $(BUILDDIR)/etc/pacman.conf > pacman.conf
cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(BUILDDIR)/

fakechroot -- fakeroot -- pacman -Sy -r $(BUILDDIR) \
--noconfirm --dbpath $(BUILDDIR)/var/lib/pacman \
--config $(BUILDDIR)/etc/pacman.conf \
--config pacman.conf \
--noscriptlet \
--hookdir $(BUILDDIR)/alpm-hooks/usr/share/libalpm/hooks/ $(2)

cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(BUILDDIR)/

fakechroot -- fakeroot -- chroot $(BUILDDIR) update-ca-trust
fakechroot -- fakeroot -- chroot $(BUILDDIR) locale-gen
fakechroot -- fakeroot -- chroot $(BUILDDIR) sh -c 'pacman-key --init && pacman-key --populate archlinux blackarch && bash -c "rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*"'
echo 'allow-weak-key-signatures' >> $(BUILDDIR)/etc/pacman.d/gnupg/gpg.conf

ln -fs /etc/os-release $(BUILDDIR)/usr/lib/os-release

# add system users
fakechroot -- fakeroot -- chroot $(BUILDDIR) /usr/bin/systemd-sysusers --root "/"

Expand All @@ -36,11 +35,11 @@ define rootfs
# fakeroot to map the gid/uid of the builder process to root
fakeroot -- tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f $(OUTPUTDIR)/$(1).tar

cd $(OUTPUTDIR); xz -9 -T0 -f $(1).tar; sha256sum $(1).tar.xz > $(1).tar.xz.SHA256
cd $(OUTPUTDIR); zstd --long -T0 -8 $(1).tar; sha256sum $(1).tar.zst > $(1).tar.zst.SHA256
endef

define dockerfile
sed -e "s|TEMPLATE_ROOTFS_FILE|$(1).tar.xz|" \
sed -e "s|TEMPLATE_ROOTFS_FILE|$(1).tar.zst|" \
Dockerfile.template > $(OUTPUTDIR)/Dockerfile.$(1)
endef

Expand Down
39 changes: 28 additions & 11 deletions pacman.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ Architecture = auto
# Misc options
#UseSyslog
#Color
#NoProgressBar
CheckSpace
#VerbosePkgLists
#ParallelDownloads = 5
NoProgressBar
# We cannot check disk space from within a chroot environment
#CheckSpace
VerbosePkgLists
ParallelDownloads = 5

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
Expand All @@ -59,7 +60,7 @@ LocalFileSigLevel = Optional
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
# Include = rootfsIncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
Expand All @@ -69,20 +70,36 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

#[core-testing]
#Include = rootfs/etc/pacman.d/mirrorlist

[core]
Include = rootfs/etc/pacman.d/mirrorlist

#[extra-testing]
#Include = rootfs/etc/pacman.d/mirrorlist

[extra]
Include = rootfs/etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

#[multilib]
#Include = /etc/pacman.d/mirrorlist
#
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
[multilib]
Include = rootfs/etc/pacman.d/mirrorlist

[blackarch]
Include = rootfs/etc/pacman.d/blackarch-mirrorlist

[options]
NoExtract = usr/lib/os-release
NoExtract = usr/share/help/* !usr/share/help/en*
NoExtract = usr/share/gtk-doc/html/* usr/share/doc/*
NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/*
NoExtract = !*locale*/en*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.*
NoExtract = !usr/share/*locales/en_?? !usr/share/*locales/i18n* !usr/share/*locales/iso*
NoExtract = !usr/share/*locales/trans*
NoExtract = usr/share/man/* usr/share/info/*
NoExtract = usr/share/vim/vim*/lang/*

0 comments on commit 376f3f2

Please sign in to comment.