diff options
-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 ${@} |