void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

xbps-src-dofetch.sh (1198B)


      1#!/bin/bash
      2#
      3# vim: set ts=4 sw=4 et:
      4#
      5# Passed arguments:
      6# 	$1 - pkgname [REQUIRED]
      7#	$2 - cross target [OPTIONAL]
      8
      9if [ $# -lt 1 -o $# -gt 2 ]; then
     10    echo "${0##*/}: invalid number of arguments: pkgname [cross-target]"
     11    exit 1
     12fi
     13
     14PKGNAME="$1"
     15XBPS_CROSS_BUILD="$2"
     16
     17for f in $XBPS_SHUTILSDIR/*.sh; do
     18    . $f
     19done
     20
     21setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
     22
     23for f in $XBPS_COMMONDIR/environment/fetch/*.sh; do
     24    source_file "$f"
     25done
     26
     27XBPS_FETCH_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_fetch_done"
     28
     29if [ -f "$XBPS_FETCH_DONE" ]; then
     30    exit 0
     31fi
     32
     33# Run pre-fetch hooks.
     34run_pkg_hooks pre-fetch
     35
     36# If template defines pre_fetch(), use it.
     37if declare -f pre_fetch >/dev/null; then
     38    run_func pre_fetch
     39fi
     40
     41# If template defines do_fetch(), use it rather than the hooks.
     42if declare -f do_fetch >/dev/null; then
     43    cd ${XBPS_BUILDDIR}
     44    [ -n "$build_wrksrc" ] && mkdir -p "$wrksrc"
     45    run_func do_fetch
     46else
     47    # Run do-fetch hooks.
     48    run_pkg_hooks "do-fetch"
     49fi
     50
     51# if templates defines post_fetch(), use it.
     52if declare -f post_fetch >/dev/null; then
     53    run_func post_fetch
     54fi
     55
     56# Run post-fetch hooks.
     57run_pkg_hooks post-fetch
     58
     59touch -f $XBPS_FETCH_DONE
     60
     61exit 0