diff --git a/aurget b/aurget index 277e0f6..f3085c2 100755 --- a/aurget +++ b/aurget @@ -193,6 +193,17 @@ buildpkg() { fi } +cache_pkgs() { + cd "${1}" + + pkg_names=( $($makepkg --packagelist) ) + + for pkg in "${pkg_names[@]}"; do + debug "caching package \"${pkg}\" in \"${pkg_cache_dir}\"" + sudo mv "${pkg}" "${pkg_cache_dir}" + done +} + prompt() { local a @@ -333,6 +344,7 @@ set_defaults() { sync_mode='install' temp_directory='/tmp/aurget' user_config="${XDG_CONFIG_HOME:-$HOME/.config}/aurgetrc" + pkg_cache_dir=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir = //') EDITOR="${EDITOR:-$VISUAL}" EDITOR="${EDITOR:-vi}" @@ -631,7 +643,7 @@ process_targets() { fi fi - build_target "$pkgbase" && discard_sources "$pkgbase" + build_target "$pkgbase" && cache_pkgs "$pkgbase" && discard_sources "$pkgbase" fi done