Skip to content

Commit

Permalink
Cache packages to CacheDir
Browse files Browse the repository at this point in the history
  • Loading branch information
mylk committed Aug 26, 2019
1 parent d82ffe3 commit 7c21a93
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion aurget
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 7c21a93

Please sign in to comment.