summaryrefslogtreecommitdiff
path: root/mkarchroot.in
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-04-05 15:36:00 -0400
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-04-05 22:17:51 +0200
commit82e6bfcd7ae9a0dc2e9ef3c48d5477aa615bef9e (patch)
tree2e04064b8176e47a190055761e4c3df0881a7f10 /mkarchroot.in
parent35da846ddeecbdb99cd4f7a5ea13d650b1fdfda3 (diff)
downloaddevtools-82e6bfcd7ae9a0dc2e9ef3c48d5477aa615bef9e.tar.xz
mkarchroot, arch-nspawn: Add an `-f` flag to add files to copy.
This allows us to copy in files like `qemu-arm-static`, which is necessary for running an ARM chroot on an x86 box.
Diffstat (limited to 'mkarchroot.in')
-rw-r--r--mkarchroot.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/mkarchroot.in b/mkarchroot.in
index 1265335..4f35c1a 100644
--- a/mkarchroot.in
+++ b/mkarchroot.in
@@ -15,21 +15,25 @@ m4_include(lib/archroot.sh)
working_dir=''
+files=()
+
usage() {
echo "Usage: ${0##*/} [options] working-dir package-list..."
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 ' -h This message'
exit 1
}
-while getopts 'hC:M:c:' arg; do
+while getopts 'hC:M:c:f:' arg; do
case "$arg" in
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
+ f) files+=("$OPTARG") ;;
h|?) usage ;;
*) error "invalid argument '%s'" "$arg"; usage ;;
esac
@@ -67,6 +71,11 @@ if is_btrfs "$working_dir"; then
chmod 0755 "$working_dir"
fi
+for file in "${files[@]}"; do
+ mkdir -p "$(dirname "$working_dir$file")"
+ cp "$file" "$working_dir$file"
+done
+
pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'