[Reproducible-commits] [reproducible-utils] 01/01: WIP: copy-dir-randomly script for "poor-man's disorderfs".

Chris Lamb chris at chris-lamb.co.uk
Fri Aug 26 10:28:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch lamby/wip/copy-dir-randomly
in repository reproducible-utils.

commit 0db5d331471c9bc39b394648be944d598c488036
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Aug 26 11:28:39 2016 +0100

    WIP: copy-dir-randomly script for "poor-man's disorderfs".
    
    Not sure it belongs in reproducible-utils as its a "diagnosis" tool rather
    than a tool to /make/ things reproducible, hence under WIP. Also, do not
    like the name.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 bin/copy-dir-randomly | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/bin/copy-dir-randomly b/bin/copy-dir-randomly
new file mode 100755
index 0000000..7988368
--- /dev/null
+++ b/bin/copy-dir-randomly
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -eu
+
+if [ "${#}" -lt 2 ]
+then
+	echo "usage: ${0}: <source-dir> <dest-dir>" >&2
+	exit 2
+fi
+
+SOURCE="${1}"
+DEST="${2}"
+shift 2
+
+if [ ! -d "${SOURCE}" ]
+then
+	echo "${0}: source dir '${SOURCE}' does not exist or is not a directory" >&2
+	exit 2
+fi
+
+if [ -d "${DEST}" ]
+then
+	echo "${0}: destination dir '${DEST}' already exists" >&2
+	exit 2
+fi
+
+mkdir -p ${DEST}
+
+cd ${SOURCE} && find -type f -print0 | \
+	sort --sort=random --zero-terminated | \
+	tar --create --no-recursion --null --files-from=- | \
+	tar --extract --directory="${DEST}" --file - "${@}"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reproducible-utils.git



More information about the Reproducible-commits mailing list