summaryrefslogtreecommitdiffstats
path: root/helper/fileutil.inc
diff options
context:
space:
mode:
authorMichael Neves2013-02-27 18:26:11 +0100
committerMichael Neves2013-02-27 18:26:11 +0100
commitf6699828c9ce0c85222d1e398c2a6dbbc8601808 (patch)
tree35ebf1ec0704aa9a4963e5d63310e7148c6c8a08 /helper/fileutil.inc
parentfirmware and modules to copy from system to stage3.1 (diff)
downloadtm-scripts-f6699828c9ce0c85222d1e398c2a6dbbc8601808.tar.gz
tm-scripts-f6699828c9ce0c85222d1e398c2a6dbbc8601808.tar.xz
tm-scripts-f6699828c9ce0c85222d1e398c2a6dbbc8601808.zip
move generate_initramfs to fileutils
Diffstat (limited to 'helper/fileutil.inc')
-rw-r--r--helper/fileutil.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc
index 3c165d99..a1988de6 100644
--- a/helper/fileutil.inc
+++ b/helper/fileutil.inc
@@ -14,3 +14,16 @@ tarcopy () {
[ "x${PS[1]}" != "x0" ] && perror "unpacking-part of tar-copy from '$SHORT' to '$2' failed. (${PS[1]})"
}
+# generate initramfs of directory
+generate_initramfs() {
+ [ $# -ne 2 ] && perror "Sanity check failed: generate_initramfs needs exactly two params, but $# were given."
+ cd "$2" || perror "Cannot cd to '$2'"
+ find . | cpio --format="newc" --create | gzip -9 > "${MODULE_DIR}/$1"
+ local PS=($PIPESTATUS[*])
+ [ "x${PS[0]}" != "x0" ] && perror "'find .' failed."
+ [ "x${PS[1]}" != "x0" ] && perror "cpio create failed."
+ [ "x${PS[2]}" != "x0" ] && perror "gzip to '${MODULE_DIR}/$1' failed."
+ cd -
+ pinfo "initramfs of $2 created at ${MODULE_DIR}/$1"
+}
+