Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>2024-02-04 12:03:50 +0100
committerChristian Heusel <christian@heusel.eu>2024-05-18 13:53:39 +0200
commit2b62ac660d258858f7a7795a113a7056d0d2c79d (patch)
tree59dfb079ea571195bce7da3766d1a6d422a151c6 /src
parent7cb72699f651a9e7ac8996070b974e1dda0a9733 (diff)
feat(mkarchroot): allow to specify file destination inside chroot
Co-authored-by: Christian Heusel <christian@heusel.eu>
Diffstat (limited to 'src')
-rw-r--r--src/arch-nspawn.in19
-rw-r--r--src/mkarchroot.in21
2 files changed, 23 insertions, 17 deletions
diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in
index a4504a1..bd99adc 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
}
@@ -114,8 +115,10 @@ copy_hostconf () {
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"
diff --git a/src/mkarchroot.in b/src/mkarchroot.in
index fc60b4e..06cf5d2 100644
--- a/src/mkarchroot.in
+++ b/src/mkarchroot.in
@@ -22,13 +22,14 @@ nspawn_args=()
usage() {
echo "Usage: ${0##*/} [options] working-dir package-list..."
echo ' options:'
- echo ' -U Use pacman -U to install packages'
- 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 ' -U Use pacman -U to install packages'
+ 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
}
@@ -84,8 +85,10 @@ if is_btrfs "$working_dir"; then
fi
for file in "${files[@]}"; do
- mkdir -p "$(dirname "$working_dir$file")"
- cp "$file" "$working_dir$file"
+ src="${file%%:*}"
+ dst="${file#*:}"
+ mkdir -p "$(dirname "$working_dir$dst")"
+ cp "$src" "$working_dir$dst"
done
unshare --mount pacstrap -${umode}Mc ${pac_conf:+-C "$pac_conf"} "$working_dir" \