From 009c58f7c94b5f63aa41a0a82cd23ee7712f05a9 Mon Sep 17 00:00:00 2001 From: Celeste Liu Date: Thu, 13 Oct 2022 18:07:18 +0800 Subject: archbuild: add architecture-specific mount config config path: @pkgdatadir@/mount.d/${arch} config format: Each line will start with 'ro' and 'rw' will be used, other lines will be ignore, rest of line is out/path:in/path. e.g. ``` ro /some/path:/proc/cpuinfo rw /some/some/path:/var/cache/pacman/pkg ``` For example, in the RISC-V port, if we use qemu-user to build, we need to pass a parameter to makechrootpkg to map a correct /proc/cpuinfo, so that software that relies on /proc/cpuinfo to obtain information can be built normally. Signed-off-by: Celeste Liu --- src/archbuild.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/archbuild.in b/src/archbuild.in index e6cf19a..ba3ba94 100644 --- a/src/archbuild.in +++ b/src/archbuild.in @@ -23,6 +23,22 @@ if [[ -f "@pkgdatadir@/setarch-aliases.d/${arch}" ]]; then else set_arch="${arch}" fi + +# Architecture-specific Mount +arch_mounts=() +if [[ -f "@pkgdatadir@/mount.d/${arch}" ]]; then + mapfile -t arch_mounts < "@pkgdatadir@/mount.d/${arch}" +fi +for arch_mount in "${arch_mounts[@]}"; do + if [[ $arch_mount = rw* ]]; then + arch_mount=${arch_mount#rw } + in_array "$arch_mount" "${makechrootpkg_args[@]}" || makechrootpkg_args+=("-d" "$arch_mount") + elif [[ $arch_mount = ro* ]]; then + arch_mount=${arch_mount#ro } + in_array "$arch_mount" "${makechrootpkg_args[@]}" || makechrootpkg_args+=("-D" "$arch_mount") + fi +done + chroots='/var/lib/archbuild' clean_first=false -- cgit v1.2.3-70-g09d2