Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmkarchroot19
1 files changed, 11 insertions, 8 deletions
diff --git a/mkarchroot b/mkarchroot
index 69fac22..a27a57b 100755
--- a/mkarchroot
+++ b/mkarchroot
@@ -13,6 +13,7 @@ RUN=""
NOCOPY="n"
working_dir=""
+cache_dir=$(grep -m 1 '^CacheDir' /etc/pacman.conf | sed 's/CacheDir\s*=\s*//')
APPNAME=$(basename "${0}")
@@ -24,14 +25,15 @@ usage ()
echo " -r <app> Run 'app' within the context of the chroot"
echo " -u Update the chroot via pacman"
echo " -f Force overwrite of files in the working-dir"
- echo " -C <file> location of a pacman config file"
- echo " -M <file> location of a makepkg config file"
- echo " -n do not copy config files into the chroot"
+ echo " -C <file> Location of a pacman config file"
+ echo " -M <file> Location of a makepkg config file"
+ echo " -n Do not copy config files into the chroot"
+ echo " -c <dir> Set pacman cache. Default: ${cache_dir}"
echo " -h This message"
exit $1
}
-while getopts 'r:ufhC:M:' arg; do
+while getopts 'r:ufhC:M:c:' arg; do
case "${arg}" in
r) RUN="$OPTARG" ;;
u) RUN="pacman -Syu" ;;
@@ -39,6 +41,7 @@ while getopts 'r:ufhC:M:' arg; do
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
n) NOCOPY="y" ;;
+ c) cache_dir="$OPTARG" ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@@ -80,9 +83,9 @@ chroot_mount ()
[ -e "${working_dir}/dev" ] || mkdir "${working_dir}/dev"
mount -o bind /dev "${working_dir}/dev"
- echo "binding pacman cache : /var/cache/pacman"
- [ -e "${working_dir}/var/cache/pacman" ] || mkdir -p "${working_dir}/var/cache/pacman"
- mount -o bind /var/cache/pacman "${working_dir}/var/cache/pacman"
+ echo "binding pacman cache : ${cache_dir}"
+ [ -e "${working_dir}/var/cache/pacman/pkg" ] || mkdir -p "${working_dir}/var/cache/pacman/pkg"
+ mount -o bind "${cache_dir}" "${working_dir}/var/cache/pacman/pkg"
trap 'chroot_umount' 0 1 2 15
}
@@ -103,7 +106,7 @@ chroot_umount ()
umount "${working_dir}/proc"
umount "${working_dir}/sys"
umount "${working_dir}/dev"
- umount "${working_dir}/var/cache/pacman"
+ umount "${working_dir}/var/cache/pacman/pkg"
}
# }}}