index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2024-08-16 08:06:08 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2024-08-16 08:06:08 +0200 |
commit | deffc1b87e86fffa8e4758a76a1912c6c8f69a85 (patch) | |
tree | 0f61a152c4c49d40de5042df2b25cdb8e0b0a82d /src/arch-nspawn.in | |
parent | 2994bca96781afd62104c1515532a9c479cb5bed (diff) | |
parent | 27eebe383d0b571c08cba991e4824768d7623602 (diff) |
-rw-r--r-- | src/arch-nspawn.in | 23 |
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in index 8fcdead..54e474f 100644 --- a/src/arch-nspawn.in +++ b/src/arch-nspawn.in @@ -22,12 +22,13 @@ usage() { echo "A wrapper around systemd-nspawn. Provides support for pacman." echo echo ' options:' - echo ' -C <file> Location of a pacman config file' - echo ' -M <file> Location of a makepkg config file' - echo ' -c <dir> Set pacman cache' - echo ' -f <file> Copy file from the host to the chroot' - echo ' -s Do not run setarch' - echo ' -h This message' + echo ' -C <file> Location of a pacman config file' + echo ' -M <file> Location of a makepkg config file' + echo ' -c <dir> Set pacman cache' + echo ' -f <src>[:<dst>] Copy src file from the host to the chroot.' + echo ' If dst file is not provided, it defaults to src' + echo ' -s Do not run setarch' + echo ' -h This message' exit 1 } @@ -63,6 +64,7 @@ nspawn_args=( --slice="devtools-$(systemd-escape "${SUDO_USER:-$USER}")" --machine="arch-nspawn-$$" --as-pid2 + --console=autopipe ) if (( ${#cache_dirs[@]} == 0 )); then @@ -71,6 +73,7 @@ fi # shellcheck disable=2016 host_mirrors=($(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;t;s#(.*/)[^/]+/extra(/?)$#\1$arch/$repo\2#')) +host_cachemirrors=($(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo extra CacheServer 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')) for host_mirror in "${host_mirrors[@]}"; do if [[ $host_mirror == *file://* ]]; then @@ -107,13 +110,17 @@ copy_hostconf () { tee "$working_dir/etc/pacman.d/mirrorlist" > \ "$working_dir/etc/pacman.d/mirrorlist32" + [[ -n $host_cachemirrors ]] && printf 'CacheServer = %s\n' "${host_cachemirrors[@]}" >>"$working_dir/etc/pacman.d/mirrorlist" + [[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf" [[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf" local file for file in "${files[@]}"; do - mkdir -p "$(dirname "$working_dir$file")" - cp -T "$file" "$working_dir$file" + src="${file%%:*}" + dst="${file#*:}" + mkdir -p "$(dirname "$working_dir$dst")" + cp -T "$src" "$working_dir$dst" done sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${cache_dirs[*]}|g" -i "$working_dir/etc/pacman.conf" |