summaryrefslogtreecommitdiff
path: root/pkgself.sh
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2018-02-05 22:11:22 -0700
committerAaron Ball <nullspoon@oper.io>2018-02-05 22:11:22 -0700
commitc83c8dcecaefcd54b944e2f82bef99350f8a1f35 (patch)
treeba0054735cfa6ac85b0cc5479409a3d30b1f1af8 /pkgself.sh
parentaac65bdd2e0b0cd6eccec09adf470a8b915212f3 (diff)
downloadpkgself-c83c8dcecaefcd54b944e2f82bef99350f8a1f35.tar.gz
pkgself-c83c8dcecaefcd54b944e2f82bef99350f8a1f35.tar.xz
pkgself: More stablity updates
Added new selfdir variable to provide the absolute path to the directory containing the pkgself script. This will enable the easy inclusion of installer resources (such as libraries). Added check to ensure a Pkgfile is specified
Diffstat (limited to 'pkgself.sh')
-rwxr-xr-xpkgself.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/pkgself.sh b/pkgself.sh
index 8a0d28e..faba888 100755
--- a/pkgself.sh
+++ b/pkgself.sh
@@ -58,11 +58,19 @@ download_src() {
main() {
- local pkg=${1}
- local pkgdir # Path to the parent directory of the Pkgfile
- local tmp # Path to the temp directory containing build resource
- local output # Path to the output file
+ local pkg="${1:-}"
+ local selfdir # Run directory of builder script
+ local pkgdir # Path to the parent directory of the Pkgfile
+ local tmp # Path to the temp directory containing build resource
+ local output # Path to the output file
+
+ if [ -z "${pkg:-}" ]; then
+ printf "Package file must be specified\n"
+ return 1
+ fi
+ # Absolute path to the parent directory of the build script (me!)
+ selfdir="$(cd $(dirname ${0}) && pwd)"
# Get the absolute path to the Pkgfile parent directory
pkgdir="$(cd $(dirname ${pkg}) && pwd)"
# Convert pkg to absolute path
@@ -96,7 +104,7 @@ main() {
local output="${pkgdir}/${name}#${version}-${release}.sh"
# Copy the installer header script into the tmp directory, with the right name
- cp install-header.sh "${output}"
+ cp ${selfdir}/install-header.sh "${output}"
# Copy the run script into the tmp dir
install "${pkgdir}/run.sh" "${PKGSRC}/run.sh"

Generated by cgit