diff options
author | Allan McRae <allan@archlinux.org> | 2010-02-13 09:06:59 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-02-13 09:57:49 +0100 |
commit | a6e1f8cfd300ce591c279f7e1093ca059ae6b56e (patch) | |
tree | 80ff67c72e1ec5914477ff82a3d08cd6d10b536c /mkarchroot | |
parent | 70d7baee6833b5d68de6a878c8a8873afa25b503 (diff) | |
download | devtools-a6e1f8cfd300ce591c279f7e1093ca059ae6b56e.tar.gz devtools-a6e1f8cfd300ce591c279f7e1093ca059ae6b56e.tar.xz |
Read cachedir from pacman.conf in working dir
This allows setting a different cachedir for (e.g.) i686 and x86_64
chroots.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Diffstat (limited to 'mkarchroot')
-rwxr-xr-x | mkarchroot | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -13,7 +13,6 @@ RUN="" NOCOPY="n" working_dir="" -cache_dir=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir\s*=\s*//') APPNAME=$(basename "${0}") @@ -67,6 +66,13 @@ shift 1 [ "${working_dir}" = "" ] && echo "error: please specify a working directory" && usage 1 +if [ -z "$cachedir" ]; then + cache_conf=${working_dir}/etc/pacman.conf + [ ! -f $cache_conf ] && cache_conf=${pac_conf:-/etc/pacman.conf} + cache_dir=$((grep -m 1 '^CacheDir' $cache_conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir\s*=\s*//') + unset cache_conf +fi + # {{{ functions chroot_mount () @@ -80,9 +86,9 @@ chroot_mount () [ -e "${working_dir}/dev" ] || mkdir "${working_dir}/dev" mount -o bind /dev "${working_dir}/dev" - [ -e "${working_dir}/var/cache/pacman/pkg" ] || mkdir -p "${working_dir}/var/cache/pacman/pkg" [ -e "${cache_dir}" ] || mkdir -p "${cache_dir}" - mount -o bind "${cache_dir}" "${working_dir}/var/cache/pacman/pkg" + [ -e "${working_dir}/${cache_dir}" ] || mkdir -p "${working_dir}/${cache_dir}" + mount -o bind "${cache_dir}" "${working_dir}/${cache_dir}" trap 'chroot_umount' 0 1 2 15 } @@ -99,7 +105,7 @@ chroot_umount () umount "${working_dir}/proc" umount "${working_dir}/sys" umount "${working_dir}/dev" - umount "${working_dir}/var/cache/pacman/pkg" + umount "${working_dir}/${cache_dir}" } # }}} |