summaryrefslogtreecommitdiffstats
path: root/pacstrap.in
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-11-22 04:41:38 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2022-11-22 04:41:38 -0500
commitddb281387aa1c4981bb3059d5703ab17fd6ab191 (patch)
tree5d3f398933f029b3dc27d12e5b32f679f348df11 /pacstrap.in
parente650b9b0ff24240197cf0a6f26642fa660e2a110 (diff)
New upstream version 28.upstream/28upstream
Diffstat (limited to 'pacstrap.in')
-rw-r--r--pacstrap.in26
1 files changed, 17 insertions, 9 deletions
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 <<EOF
@@ -27,11 +30,13 @@ usage: ${0##*/} [options] root [packages...]
Options:
-C <config> 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