From 192aa6fbdf1ed6fc441d56a14adf4479bd2799fa Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Sun, 28 Dec 2014 22:25:58 -0700 Subject: [PATCH 1/8] makechrootpkg: cache dir --- makechrootpkg.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index d4c293f..bf81573 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -38,6 +38,7 @@ usage() { echo 'Flags:' echo '-h This help' echo '-c Clean the chroot before building' + echo '-C Set pacman cache to pass to arch-nspawn' echo '-d Bind directory into build chroot as read-write' echo '-D Bind directory into build chroot as read-only' echo '-u Update the working copy of the chroot before building' @@ -323,12 +324,13 @@ main() { [[ -z "$copy" || $copy = root ]] && copy=copy src_owner=${SUDO_USER:-$USER} - while getopts 'hcur:I:l:nTD:d:U:' arg; do + while getopts 'hcuC:r:I:l:nTD:d:U:' arg; do case "$arg" in c) clean_first=true ;; D) bindmounts_ro+=("--bind-ro=$OPTARG") ;; d) bindmounts_rw+=("--bind=$OPTARG") ;; u) update_first=true ;; + C) cache_dir="$OPTARG" ;; r) passeddir="$OPTARG" ;; I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; @@ -350,6 +352,10 @@ main() { [[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir" [[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir" + if [ -n "$cache_dir" ]; then + cache_dir="-c $cache_dir" + fi + if [[ ${copy:0:1} = / ]]; then copydir=$copy else @@ -413,7 +419,7 @@ main() { prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" - if arch-nspawn "$copydir" \ + if arch-nspawn $cache_dir "$copydir" \ --bind="$PWD:/startdir" \ --bind="$SRCDEST:/srcdest" \ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ -- 2.14.1