summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2017-06-23 08:43:13 -0600
committerAaron Ball <nullspoon@oper.io>2017-06-23 08:43:13 -0600
commita71a314d87224ae9b4222642c5fc5c426ffbb166 (patch)
treee97c49a1f18f16de229a1ae206436d3a05e401bb /lib
parent533cff3fadcf3b4bf2e18fe011459620a2e3b757 (diff)
downloadportimg-a71a314d87224ae9b4222642c5fc5c426ffbb166.tar.gz
portimg-a71a314d87224ae9b4222642c5fc5c426ffbb166.tar.xz
Added footprinting support
This adds libcommon, which contains the footprint_dir function. Also added calls to it in pkgimg.sh. Added more user messages to indicate the build destination path, footprint path, and compressed tarball/package path.
Diffstat (limited to 'lib')
-rw-r--r--lib/common.sh48
1 files changed, 48 insertions, 0 deletions
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