### this file is sourced not run
PKGVER=4.0.2
PKGBUILD=1
PKGARCH=noarch

# source: james
# this is how we securely handle external package

TARBALL=findnrun-${PKGVER}-${PKGBUILD}.tar.xz
MD5SUM=c6dc96a8d0200dc17a3fed6b7b1b8059
SRC_URL="https://docs.google.com/uc?id=1iAayANP5YF7uDIfFEpCc-1Ltqw_oj0ca&export=download"
BUNDLE=

SLACKREQ=  # internal copy
SLACKDESC= # internal copy 

PKG_NOMAKEPKG=yes

### default pkg_download
### prepare
pkg_prepare() {
	if pkg_check $SRC_DIR $TARBALL $MD5SUM; then
		cp $SRC_DIR/$TARBALL tmp/pkg
	else
		return 1		
	fi
}

### default pkg_package
### build
pkg_build() {
	# extract and delete scripts
	# process in chroot, so bad things cannot impact the host
	
	mkdir -p /tmp/build && cd /tmp/build &&
	tar -xf /tmp/pkg/$TARBALL &&
	patch --no-backup-if-mismatch -p1 -i /tmp/pkg/fd800-fossil-install-fzf.patch &&
	rm -f install/{doinst.sh,slack-uninstall.sh} # remove scripts
}

pkg_package() {
	# run makepkg ourselves to preseve original build recipes
	# and only process files inside /tmp/build, so any excess files
	# installed outside this, are not processed.
	cd tmp/build &&
	$MAKEPKG -c n -l n $OUTPUT_DIR/$PKG.$PKG_TYPE > /dev/null 2>&1
}

# vim:ft=sh:


