summaryrefslogtreecommitdiffstats
path: root/release/scripts
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-01-26 19:45:09 +0000
committerjhb <jhb@FreeBSD.org>2004-01-26 19:45:09 +0000
commit7785c3a86ed936300c11664fe06dc226af817768 (patch)
tree8e21b812e23b7ad85108482b848abdb46df790e9 /release/scripts
parent6d98b2c93e2b6c64045b4f9551ce8f1aedc9d650 (diff)
downloadFreeBSD-src-7785c3a86ed936300c11664fe06dc226af817768.zip
FreeBSD-src-7785c3a86ed936300c11664fe06dc226af817768.tar.gz
Add a script to split a single file up into chunks using split along with
a list file suitable for use with libstand's splitfs filesystem. The first chunk of the file is 16k and has an extension of '.boot' and is meant to be placed on the boot floppy. This is required because the current implementations of gzipfs and bzipfs in libstand want to read in the header of the file each time it is opened.
Diffstat (limited to 'release/scripts')
-rwxr-xr-xrelease/scripts/split-file.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/release/scripts/split-file.sh b/release/scripts/split-file.sh
new file mode 100755
index 0000000..9dcf1a4
--- /dev/null
+++ b/release/scripts/split-file.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# Bail if things fail and be verbose about what we are doing
+set -ex
+
+# Arguments are as follows: file destdir chunksize description
+FILE=$1; shift
+DEST=$1; shift
+CHUNK_SIZE=$1; shift
+DESCR=$1; shift
+
+# Make sure we can read the file.
+[ -r ${FILE} ]
+
+# Create clean working area to stick file chunks and list in
+rm -rf ${DEST} || true
+mkdir -p ${DEST}
+
+# Split the file into pieces
+prefix=`basename $FILE`
+dd if=${FILE} bs=16k iseek=1 | split -b ${CHUNK_SIZE}k - ${DEST}/${prefix}.
+
+# Create a special file for the first 16k that gets stuck on the boot
+# floppy
+files=`ls ${DEST}/${prefix}.*`
+first=`echo "${files}" | head -1`
+bootchunk="${DEST}/${prefix}.boot"
+dd if=${FILE} of=${bootchunk} bs=16k count=1
+
+# Create the split index file
+echo `basename ${bootchunk}` "\"Boot floppy\"" > ${DEST}/${prefix}.split
+i=1
+for file in ${files}; do
+ echo `basename ${file}` "\"${DESCR} floppy ${i}\"" >> ${DEST}/${prefix}.split
+ i=$((i + 1))
+done
OpenPOWER on IntegriCloud