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. --- common | 2 +- completion/pacstrap.bash | 2 +- doc/pacstrap.8.asciidoc | 6 ++++++ genfstab.in | 9 +++++++++ pacstrap.in | 26 +++++++++++++++++--------- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/common b/common index 868d481..5768dd2 100644 --- a/common +++ b/common @@ -56,7 +56,7 @@ declare -A pseudofs_types=([anon_inodefs]=1 [virtiofs]=1) # generated from: pkgfile -vbr '/fsck\..+' | awk -F. '{ print $NF }' | sort -declare -A fsck_types=([btrfs]=1 +declare -A fsck_types=([btrfs]=0 # btrfs doesn't need a regular fsck utility [cramfs]=1 [erofs]=1 [exfat]=1 diff --git a/completion/pacstrap.bash b/completion/pacstrap.bash index 25d2211..d064d1e 100644 --- a/completion/pacstrap.bash +++ b/completion/pacstrap.bash @@ -8,7 +8,7 @@ _pacstrap() { COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="-C -c -G -i -K -M -N -h" + opts="-C -c -D -G -i -K -M -N -P -U -h" for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do if [[ -d ${i} ]]; then diff --git a/doc/pacstrap.8.asciidoc b/doc/pacstrap.8.asciidoc index 3b76aa9..610c71c 100644 --- a/doc/pacstrap.8.asciidoc +++ b/doc/pacstrap.8.asciidoc @@ -28,6 +28,9 @@ Options *-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. @@ -45,6 +48,9 @@ Options mount and user namespace, allowing regular users to create new system installations. +*-P*:: + Copy the host's pacman config to the target. + *-U*:: Use pacman -U to install packages. Useful for obtaining fine-grained control over the installed packages. diff --git a/genfstab.in b/genfstab.in index 6a2ad10..df2b802 100644 --- a/genfstab.in +++ b/genfstab.in @@ -58,6 +58,14 @@ optstring_apply_quirks() { fi case $fstype in + btrfs) + # Having only one of subvol= and subvolid= is enough for mounting a btrfs subvolume + # And having subvolid= set prevents things like 'snapper rollback' to work, as it + # updates the subvolume in-place, leaving subvol= unchanged with a different subvolid. + if optstring_has_option "$varname" subvol; then + optstring_remove_option "$varname" subvolid + fi + ;; f2fs) # These are Kconfig options for f2fs. Kernels supporting the options will # only provide the negative versions of these (e.g. noacl), and vice versa @@ -166,6 +174,7 @@ findmnt -Recvruno SOURCE,TARGET,FSTYPE,OPTIONS,FSROOT "$root" | if [[ $fsroot != / && $fstype != btrfs ]]; then # it's a bind mount src=$(findmnt -funcevo TARGET "$src")$fsroot + src="/${src#$root/}" if [[ $src -ef $target ]]; then # hrmm, this is weird. we're probably looking at a file or directory # that was bound into a chroot from the host machine. Ignore it, 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