clojure-lsp: update to 2024.08.05.
[void-pkg.git] / common / xbps-src / libexec / xbps-src-dofetch.sh
blob07aef66ba720124fe0d408df4cc83e6dc17133b5
1 #!/bin/bash
3 # vim: set ts=4 sw=4 et:
5 # Passed arguments:
6 # $1 - pkgname [REQUIRED]
7 # $2 - cross target [OPTIONAL]
9 if [ $# -lt 1 -o $# -gt 2 ]; then
10 echo "${0##*/}: invalid number of arguments: pkgname [cross-target]"
11 exit 1
14 PKGNAME="$1"
15 XBPS_CROSS_BUILD="$2"
17 for f in $XBPS_SHUTILSDIR/*.sh; do
18 . $f
19 done
21 setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
23 for f in $XBPS_COMMONDIR/environment/fetch/*.sh; do
24 source_file "$f"
25 done
27 XBPS_FETCH_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_fetch_done"
29 if [ -f "$XBPS_FETCH_DONE" ]; then
30 exit 0
33 # Run pre-fetch hooks.
34 run_pkg_hooks pre-fetch
36 # If template defines pre_fetch(), use it.
37 if declare -f pre_fetch >/dev/null; then
38 run_func pre_fetch
41 # If template defines do_fetch(), use it rather than the hooks.
42 if declare -f do_fetch >/dev/null; then
43 cd ${XBPS_BUILDDIR}
44 [ -n "$build_wrksrc" ] && mkdir -p "$wrksrc"
45 run_func do_fetch
46 else
47 # Run do-fetch hooks.
48 run_pkg_hooks "do-fetch"
51 cd ${XBPS_BUILDDIR} || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
52 # if templates defines post_fetch(), use it.
53 if declare -f post_fetch >/dev/null; then
54 run_func post_fetch
57 # Run post-fetch hooks.
58 run_pkg_hooks post-fetch
60 touch -f $XBPS_FETCH_DONE
62 exit 0