From ddb281387aa1c4981bb3059d5703ab17fd6ab191 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Tue, 22 Nov 2022 04:41:38 -0500 Subject: New upstream version 28. --- pacstrap.in | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'pacstrap.in') diff --git a/pacstrap.in b/pacstrap.in index 0e25ef8..d1ec8d5 100644 --- a/pacstrap.in +++ b/pacstrap.in @@ -16,9 +16,12 @@ hostcache=0 copykeyring=1 initkeyring=0 copymirrorlist=1 +pacman_args=() pacmode=-Sy setup=chroot_setup unshare=0 +copyconf=0 +pacman_config=/etc/pacman.conf usage() { cat < Use an alternate config file for pacman -c Use the package cache on the host, rather than the target + -D Skip pacman dependency checks -G Avoid copying the host's pacman keyring to the target -i Prompt for package confirmation when needed (run interactively) -K Initialize an empty pacman keyring in the target (implies '-G') -M Avoid copying the host's mirrorlist to the target -N Run in unshare mode as a regular user + -P Copy the host's pacman config to the target -U Use pacman -U to install packages -h Print this help message @@ -47,13 +52,13 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then exit $(( $# ? 0 : 1 )) fi -while getopts ':C:cdGiKMNU' flag; do +while getopts ':C:cDGiKMNPU' flag; do case $flag in C) pacman_config=$OPTARG ;; - d) - # retired flag. does nothing. + D) + pacman_args+=(-dd) ;; c) hostcache=1 @@ -74,6 +79,9 @@ while getopts ':C:cdGiKMNU' flag; do setup=unshare_setup unshare=1 ;; + P) + copyconf=1 + ;; U) pacmode=-U ;; @@ -89,7 +97,7 @@ shift $(( OPTIND - 1 )) (( $# )) || die "No root directory specified" newroot=$1; shift -pacman_args=("${@:-base}") +pacman_args+=("$pacmode" "${@:-base}" --config="$pacman_config") if (( ! hostcache )); then pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg") @@ -99,10 +107,6 @@ if (( ! interactive )); then pacman_args+=(--noconfirm) fi -if [[ $pacman_config ]]; then - pacman_args+=(--config="$pacman_config") -fi - [[ -d $newroot ]] || die "%s is not a directory" "$newroot" pacstrap() { @@ -127,7 +131,7 @@ pacstrap() { fi msg 'Installing packages to %s' "$newroot" - if ! $pid_unshare pacman -r "$newroot" $pacmode "${pacman_args[@]}"; then + if ! $pid_unshare pacman -r "$newroot" "${pacman_args[@]}"; then die 'Failed to install packages to new root' fi @@ -135,6 +139,10 @@ pacstrap() { # install the host's mirrorlist onto the new root cp -a /etc/pacman.d/mirrorlist "$newroot/etc/pacman.d/" fi + + if (( copyconf )); then + cp -a "$pacman_config" "$newroot/etc/pacman.conf" + fi } if (( unshare )); then -- cgit v1.2.3