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 <CoelacanthusHex@gmail.com>
This commit is contained in:
Celeste Liu 2022-10-13 18:07:18 +08:00 committed by Levente Polyak
parent 112026580d
commit 009c58f7c9
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 16 additions and 0 deletions

View File

@ -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