diff options
author | Aaron Ball <nullspoon@oper.io> | 2017-06-23 11:23:38 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2017-06-23 11:23:38 -0600 |
commit | b1bb144bf791e19acc7c662857911103275d9f0f (patch) | |
tree | 65fe36565aa66f4678a7fab97cd176c512c2ad3e | |
parent | a268ade6a60ab9912849f63b115c523f3f168626 (diff) | |
download | portimg-b1bb144bf791e19acc7c662857911103275d9f0f.tar.gz portimg-b1bb144bf791e19acc7c662857911103275d9f0f.tar.xz |
Restructured manifest file format
Now the manifest files have a shell syntax, which contains the following
required variables:
* name
* version
* release
* depends
These are loaded at runtime and are now used to name the port image
files (tarball, footprint, workspace, etc). This will allow easier
building of an image library, as the names are no longer randomly
generated, plus they are now versioned as well.
-rwxr-xr-x | bin/pkgimg.sh | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/bin/pkgimg.sh b/bin/pkgimg.sh index 462c0e1..d093c45 100755 --- a/bin/pkgimg.sh +++ b/bin/pkgimg.sh @@ -35,6 +35,13 @@ function main { local _installbase # Path to the temporary image working directory local _porttmp # Path to the temporary package working directory + # Port image variables + local _imgname # Name of the image/port collection + local _imgdepends # Dependencies to build the port image + local _imgversion # Version of the image + local _imgrelease # Release number of the image + local _imgbuildname # Name of the built image file + if [[ -z "${manifest}" ]]; then lerror "Please specify a port manifest." return 1 @@ -44,13 +51,22 @@ function main { return 2 fi + source ${manifest} + # Set all these variables as the same variables will be set later by port + # files + _imgname=${name} && unset 'name' + _imgdepends=("${depends[@]}") && unset 'depends[@]' + _imgversion=${version} && unset 'version' + _imgrelease=${release} && unset 'release' + _imgbuildname="${_imgname}#${_imgversion}_${_imgrelease}" + # Convert portsdir to absolute path PORTSDIR="$(cd ${PORTSDIR} && pwd)" - _installbase=$(mktemp -d /tmp/pkgimg-install.XXXX) + _installbase=$(mktemp -d /tmp/pkgimg-${_imgbuildname}.XXXX) # Loop over each port in the manifest - for port in $(grep -v '^#' ${manifest} | grep -v '^[ ]*$'); do + for port in ${_imgdepends[@]}; do # Call pkgmk to build the port pkgmk ${port} '_porttmp' [ $? -gt 0 ] && return 1 @@ -76,9 +92,14 @@ function main { linfo "Compressing ${_installbase}.tar" xz -v ${_installbase}.tar - linfo "Fakeroot filesystem: ${_installbase}" - linfo "Deployment tarball: ${_installbase}.tar.xz" - linfo "Tarball footprint: ${_installbase}.footprint" + # Move the package and footprint to current directory + mv ${_installbase}.tar.xz ${BASEDIR}/${_imgbuildname}.tar.xz + mv ${_installbase}.footprint ${BASEDIR}/${_imgbuildname}.footprint + + linfo "Build dir: ${_installbase}" + linfo "Deployment tarball: ${BASEDIR}/${_imgbuildname}.tar.xz" + linfo "Tarball footprint: ${BASEDIR}/${_imgbuildname}.footprint" + } main ${@} |