makechrootpkg: cache dir
This commit is contained in:
parent
6364b3c9b9
commit
b126732e34
|
@ -38,6 +38,7 @@ usage() {
|
||||||
echo 'Flags:'
|
echo 'Flags:'
|
||||||
echo '-h This help'
|
echo '-h This help'
|
||||||
echo '-c Clean the chroot before building'
|
echo '-c Clean the chroot before building'
|
||||||
|
echo '-C <dir> Set pacman cache to pass to arch-nspawn'
|
||||||
echo '-d <dir> Bind directory into build chroot as read-write'
|
echo '-d <dir> Bind directory into build chroot as read-write'
|
||||||
echo '-D <dir> Bind directory into build chroot as read-only'
|
echo '-D <dir> Bind directory into build chroot as read-only'
|
||||||
echo '-u Update the working copy of the chroot before building'
|
echo '-u Update the working copy of the chroot before building'
|
||||||
|
@ -325,12 +326,13 @@ main() {
|
||||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||||
src_owner=${SUDO_USER:-$USER}
|
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
|
case "$arg" in
|
||||||
c) clean_first=true ;;
|
c) clean_first=true ;;
|
||||||
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
||||||
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
||||||
u) update_first=true ;;
|
u) update_first=true ;;
|
||||||
|
C) cache_dir="$OPTARG" ;;
|
||||||
r) passeddir="$OPTARG" ;;
|
r) passeddir="$OPTARG" ;;
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
|
@ -352,6 +354,10 @@ main() {
|
||||||
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
[[ ! -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"
|
[[ ! -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
|
if [[ ${copy:0:1} = / ]]; then
|
||||||
copydir=$copy
|
copydir=$copy
|
||||||
else
|
else
|
||||||
|
@ -415,7 +421,7 @@ main() {
|
||||||
|
|
||||||
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
|
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
|
||||||
|
|
||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn $cache_dir "$copydir" \
|
||||||
--bind="$PWD:/startdir" \
|
--bind="$PWD:/startdir" \
|
||||||
--bind="$SRCDEST:/srcdest" \
|
--bind="$SRCDEST:/srcdest" \
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
|
|
Loading…
Reference in New Issue