diff -urN a/makechrootpkg.in b/makechrootpkg.in --- a/makechrootpkg.in 2013-05-25 15:39:46.000000000 -0500 +++ b/makechrootpkg.in 2013-06-04 16:19:08.453803346 -0500 @@ -48,6 +48,7 @@ echo 'Flags:' echo '-h This help' echo '-c Clean the chroot before building' + echo '-C Set pacman cache to pass to arch-nspawn' echo '-u Update the working copy of the chroot before building' echo ' This is useful for rebuilds without dirtying the pristine' echo ' chroot' @@ -61,11 +62,12 @@ exit 1 } -while getopts 'hcur:I:l:nT' arg; do +while getopts 'hcuC:r:I:l:nT' arg; do case "$arg" in h) usage ;; c) clean_first=true ;; u) update_first=true ;; + C) cache_dir="$OPTARG" ;; r) passeddir="$OPTARG" ;; I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; @@ -84,6 +86,10 @@ [[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '$passeddir'" [[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot $chrootdir/root base-devel" +if [ -n "$cache_dir" ]; then + cache_dir="-c $cache_dir" +fi + # Detect chrootdir filesystem type chroottype=$(stat -f -c %T "$chrootdir") @@ -346,7 +352,7 @@ download_sources -if arch-nspawn "$copydir" \ +if arch-nspawn $cache_dir "$copydir" \ --bind-ro="$PWD:/startdir_host" \ --bind-ro="$SRCDEST:/srcdest_host" \ /chrootbuild