diff options
author | Michael Neves | 2013-02-27 18:26:11 +0100 |
---|---|---|
committer | Michael Neves | 2013-02-27 18:26:11 +0100 |
commit | f6699828c9ce0c85222d1e398c2a6dbbc8601808 (patch) | |
tree | 35ebf1ec0704aa9a4963e5d63310e7148c6c8a08 /helper/fileutil.inc | |
parent | firmware and modules to copy from system to stage3.1 (diff) | |
download | tm-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.inc | 13 |
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" +} + |