pacstrap: support local file mode
Allow passing files to the underlying pacman command, instead of relying on the syncdb. This allows fine-grained control over the package files to be installed, which can be useful when initializing a build chroot for reproducible builds.
This commit is contained in:
parent
4eb54af72a
commit
e1a84d1056
@ -36,6 +36,10 @@ Options
|
||||
*-M*::
|
||||
Avoid copying the host's mirrorlist to the target.
|
||||
|
||||
*-U*::
|
||||
Use pacman -U to install packages. Useful for obtaining fine-grained
|
||||
control over the installed packages.
|
||||
|
||||
*-h*::
|
||||
Output syntax and command line options.
|
||||
|
||||
|
@ -15,6 +15,7 @@ m4_include(common)
|
||||
hostcache=0
|
||||
copykeyring=1
|
||||
copymirrorlist=1
|
||||
pacmode=-Sy
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
@ -26,6 +27,7 @@ usage: ${0##*/} [options] root [packages...]
|
||||
-G Avoid copying the host's pacman keyring to the target
|
||||
-i Prompt for package confirmation when needed (run interactively)
|
||||
-M Avoid copying the host's mirrorlist to the target
|
||||
-U Use pacman -U to install packages
|
||||
|
||||
-h Print this help message
|
||||
|
||||
@ -42,7 +44,7 @@ fi
|
||||
|
||||
(( EUID == 0 )) || die 'This script must be run with root privileges'
|
||||
|
||||
while getopts ':C:cdGiM' flag; do
|
||||
while getopts ':C:cdGiMU' flag; do
|
||||
case $flag in
|
||||
C)
|
||||
pacman_config=$OPTARG
|
||||
@ -62,6 +64,9 @@ while getopts ':C:cdGiM' flag; do
|
||||
M)
|
||||
copymirrorlist=0
|
||||
;;
|
||||
U)
|
||||
pacmode=-U
|
||||
;;
|
||||
:)
|
||||
die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG"
|
||||
;;
|
||||
@ -107,7 +112,7 @@ if (( copykeyring )); then
|
||||
fi
|
||||
|
||||
msg 'Installing packages to %s' "$newroot"
|
||||
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
|
||||
if ! unshare --fork --pid pacman -r "$newroot" $pacmode "${pacman_args[@]}"; then
|
||||
die 'Failed to install packages to new root'
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user