summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2017-06-23 08:47:49 -0600
committerAaron Ball <nullspoon@oper.io>2017-06-23 08:47:49 -0600
commitc7781d4254ef261ee78f93bf5977a68e46d6c163 (patch)
treefd4ddfb33b1204d96dd9acb97d7790f4bb237bd8
parent7cb394627508c0ad174d93dcbb8f5f2c385ae781 (diff)
parenta71a314d87224ae9b4222642c5fc5c426ffbb166 (diff)
downloadportimg-c7781d4254ef261ee78f93bf5977a68e46d6c163.tar.gz
portimg-c7781d4254ef261ee78f93bf5977a68e46d6c163.tar.xz
Merge branch 'footprinting'
-rwxr-xr-xbin/pkgimg.sh16
-rw-r--r--lib/common.sh48
2 files changed, 61 insertions, 3 deletions
diff --git a/bin/pkgimg.sh b/bin/pkgimg.sh
index 0b40171..7286f2e 100755
--- a/bin/pkgimg.sh
+++ b/bin/pkgimg.sh
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-set -eu
+set -u
export BASEDIR="$(cd $(dirname ${0})/../ && pwd)"
export LIBDIR="${BASEDIR}/lib"
@@ -24,6 +24,7 @@ export LIBDIR="${BASEDIR}/lib"
source ${LIBDIR}/log.sh
source ${LIBDIR}/pkg.sh
source ${LIBDIR}/config.sh
+source ${LIBDIR}/common.sh
export PORTSDIR=${PORTSDIR:-${BASEDIR}/ports}
export KEEP_BUILD=${KEEP_BUILD:-0}
@@ -60,9 +61,18 @@ function main {
fi
done
- dump_configs
+ linfo "Generating footprint file for ${installbase}"
+ footprint_dir ${installbase} > ${installbase}.footprint
- linfo "Fakeroot filesystem available at ${installbase}"
+ linfo "Creating deployment tarball from ${installbase}"
+ tar -cf ${installbase}.tar -C ${installbase} ./*
+
+ linfo "Compressing ${installbase}.tar"
+ xz -v ${installbase}.tar
+
+ linfo "Fakeroot filesystem: ${installbase}"
+ linfo "Deployment tarball: ${installbase}.tar.xz"
+ linfo "Tarball footprint: ${installbase}.footprint"
}
main ${@}
diff --git a/lib/common.sh b/lib/common.sh
new file mode 100644
index 0000000..edcc8f9
--- /dev/null
+++ b/lib/common.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+#
+# Portimg uses Crux port-like system for creating software deployment images.
+# Copyright (C) 2017 Aaron Ball <nullspoon@oper.io>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+#
+# Footprints the specified path in the format
+# Outputs footprint to stdout.
+#
+# @path Path to the directory to recursively footprint
+#
+function footprint_dir {
+ local path=${1:-}
+
+ if [[ -z ${path} ]]; then
+ echo "Please specify a directory to checksum."
+ return 1
+ fi
+
+ cd ${path}
+
+ # Generate a file and directory list
+ local file_list=$(find)
+
+ # Stat each file
+ for i in ${file_list[@]}; do
+ # Skip . and ..
+ [[ ${i} == '.' || ${i} == '..' ]] && continue
+
+ # Get file stats for "permissions owner:group filename"
+ stat -c '%A %U:%G %n' "${i#*/}"
+ done
+}

Generated by cgit