#!/bin/bash # # SPDX-License-Identifier: GPL-3.0-or-later _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@} # shellcheck source=src/lib/common.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh # shellcheck source=src/lib/archroot.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/archroot.sh base_packages=(base-devel) makechrootpkg_args=(-c -n -C) cmd="${0##*/}" if [[ "${cmd%%-*}" == 'multilib' ]]; then repo="${cmd%-build}" arch='x86_64' base_packages+=(multilib-devel) else tag="${cmd%-build}" repo=${tag%-*} arch=${tag##*-} fi if [[ -f "@pkgdatadir@/setarch-aliases.d/${arch}" ]]; then read -r set_arch < "@pkgdatadir@/setarch-aliases.d/${arch}" 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 pacman_config="@pkgdatadir@/pacman.conf.d/${repo}.conf" if [[ -f @pkgdatadir@/pacman.conf.d/${repo}-${arch}.conf ]]; then pacman_config="@pkgdatadir@/pacman.conf.d/${repo}-${arch}.conf" fi makepkg_config="@pkgdatadir@/makepkg.conf.d/${arch}.conf" if [[ -f @pkgdatadir@/makepkg.conf.d/${repo}-${arch}.conf ]]; then makepkg_config="@pkgdatadir@/makepkg.conf.d/${repo}-${arch}.conf" fi usage() { echo "Usage: $cmd [options] -- [makechrootpkg args]" echo ' -h This help' echo ' -c Recreate the chroot before building' echo ' -r