diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-06-23 11:37:56 +0200 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2012-06-24 16:57:20 -0300 |
commit | dd368b5a81e42d0e68faab9e4debe02fbae03cae (patch) | |
tree | 1ceca7b52eef1f1e310da1963630e63da0ee5921 | |
parent | 344dd0064ae5a3d7700a259d148371802b84bfd1 (diff) | |
download | archiso32-dd368b5a81e42d0e68faab9e4debe02fbae03cae.tar.xz |
Use the host's package cache
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
-rwxr-xr-x | configs/releng/build.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 17a9005..b18c756 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -13,7 +13,14 @@ verbose="" cmd_args="" script_path=$(readlink -f ${0%/*}) -pacman_conf="${script_path}/pacman.conf" + +setup_workdir() { + cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) + mkdir -p "${work_dir}" + pacman_conf="${work_dir}/pacman.conf" + sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" \ + "${script_path}/pacman.conf" > "${pacman_conf}" +} # Base installation (root-image) make_basefs() { @@ -169,7 +176,7 @@ make_usr_share() { # Make [core] repository, keep "any" pkgs in a separate fs (makes more "dual-iso" friendly) make_core_repo() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - local _url _urls _pkg_name _dst _pkgs _cache_dir _cache_dirs + local _url _urls _pkg_name _dst _pkgs _cache_dir mkdir -p ${work_dir}/repo-core-any mkdir -p ${work_dir}/repo-core-${arch} mkdir -p ${work_dir}/pacman.db/var/lib/pacman @@ -178,11 +185,10 @@ make_core_repo() { <(grep -v ^# ${script_path}/core.exclude.${arch} | sort | sed 's@^@core/@')) _urls=$(pacman --config "${pacman_conf}" -Sddp -r ${work_dir}/pacman.db ${_pkgs}) pacman --config "${pacman_conf}" -Swdd -r ${work_dir}/pacman.db --noprogressbar --noconfirm ${_pkgs} - _cache_dirs=($(pacman --config "${pacman_conf}" -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) for _url in ${_urls}; do _pkg_name=${_url##*/} _dst=${work_dir}/repo-core-${arch}/${_pkg_name} - for _cache_dir in ${_cache_dirs[@]}; do + for _cache_dir in ${cache_dirs[@]}; do if [[ -e "${_cache_dir}/${_pkg_name}" ]]; then cp "${_cache_dir}/${_pkg_name}" ${_dst} fi @@ -431,6 +437,8 @@ if [[ ${command_mode} == "single" ]]; then work_dir=${work_dir}/${arch} fi +setup_workdir + case "${command_name}" in build) case "${command_mode}" in |