summaryrefslogtreecommitdiff
path: root/bin/pkgimg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pkgimg.sh')
-rwxr-xr-xbin/pkgimg.sh39
1 files changed, 22 insertions, 17 deletions
diff --git a/bin/pkgimg.sh b/bin/pkgimg.sh
index 25afe11..462c0e1 100755
--- a/bin/pkgimg.sh
+++ b/bin/pkgimg.sh
@@ -32,48 +32,53 @@ export KEEP_BUILD=${KEEP_BUILD:-0}
function main {
local manifest=${1:-}
- local installbase=''
+ local _installbase # Path to the temporary image working directory
+ local _porttmp # Path to the temporary package working directory
- if [[ -z ${manifest} ]]; then
- lerror "Please provide a port manifest."
+ if [[ -z "${manifest}" ]]; then
+ lerror "Please specify a port manifest."
return 1
fi
+ if [[ ! -f "${manifest}" ]]; then
+ lerror "Path '${manifest}' does not exist or is not a manifest"
+ return 2
+ fi
# Convert portsdir to absolute path
PORTSDIR="$(cd ${PORTSDIR} && pwd)"
- installbase=$(mktemp -d /tmp/pkgimg-install.XXXX)
+ _installbase=$(mktemp -d /tmp/pkgimg-install.XXXX)
# Loop over each port in the manifest
for port in $(grep -v '^#' ${manifest} | grep -v '^[ ]*$'); do
# Call pkgmk to build the port
- pkgmk ${port}
+ pkgmk ${port} '_porttmp'
[ $? -gt 0 ] && return 1
# Move the package contents to the install base
- linfo "Synchronizing ${port} build to install base ${installbase}"
- rsync -a ${PORTTMP}/pkg/ ${installbase}/
+ linfo "Synchronizing ${port} build to install base ${_installbase}"
+ rsync -a ${_porttmp}/pkg/ ${_installbase}/
# Cleanup
if [ "${KEEP_BUILD}" = 0 ]; then
- rm -rf ${PORTTMP}
+ rm -rf ${_porttmp}
else
linfo "KEEP_BUILD is set. Skipping cleanup of ${port}."
fi
done
- linfo "Generating footprint file for ${installbase}"
- footprint_dir ${installbase} > ${installbase}.footprint
+ linfo "Generating footprint file for ${_installbase}"
+ footprint_dir ${_installbase} > ${_installbase}.footprint
- linfo "Creating deployment tarball from ${installbase}"
- tar -cf ${installbase}.tar -C ${installbase} ./*
+ linfo "Creating deployment tarball from ${_installbase}"
+ tar -cf ${_installbase}.tar -C ${_installbase} ./*
- linfo "Compressing ${installbase}.tar"
- xz -v ${installbase}.tar
+ linfo "Compressing ${_installbase}.tar"
+ xz -v ${_installbase}.tar
- linfo "Fakeroot filesystem: ${installbase}"
- linfo "Deployment tarball: ${installbase}.tar.xz"
- linfo "Tarball footprint: ${installbase}.footprint"
+ linfo "Fakeroot filesystem: ${_installbase}"
+ linfo "Deployment tarball: ${_installbase}.tar.xz"
+ linfo "Tarball footprint: ${_installbase}.footprint"
}
main ${@}

Generated by cgit