From 9c41477719971d04276e4c271fe5070314fff753 Mon Sep 17 00:00:00 2001 From: Rahul C S Date: Mon, 27 Feb 2012 16:19:42 +0530 Subject: precreate .glusterfs directory in the backend Thanks to Avati for the patch Helps creating .glusterfs directory hierarchy structure in the backend. Could be useful for the client as well. Signed-off-by: Rahul C S Change-Id: Ia540c4b6a3e4ea3b05aa7de216ff6c3734eb5792 --- helper_scripts/glusterfs-precreate.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 helper_scripts/glusterfs-precreate.sh (limited to 'helper_scripts') diff --git a/helper_scripts/glusterfs-precreate.sh b/helper_scripts/glusterfs-precreate.sh new file mode 100755 index 0000000..c5b62a2 --- /dev/null +++ b/helper_scripts/glusterfs-precreate.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e; + +if [ $# -eq 0 ]; then + echo "Usage: $0 [dir2 [dir3 [dir4 ...]]]"; + exit 1 +fi + +for dir in "$@"; do + if [ ! -d "$dir" ]; then + echo "$0: $dir not a directory" + exit 1; + fi +done + +subdirs="{00" +for i in {1..255}; do + n=$(printf "%02x" $i); + subdirs="$subdirs,$n"; +done +subdirs="$subdirs}" + +mkdir -vp "$dir/.glusterfs"; + +for dir in $@; do + for i in {0..255}; do + n=$(printf "%02x" $i); + mkdir -vp "$dir/.glusterfs/$n" + eval "mkdir -vp $dir/.glusterfs/$n/$subdirs" + done +done \ No newline at end of file -- cgit