summaryrefslogtreecommitdiffstats
path: root/helper_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'helper_scripts')
-rwxr-xr-xhelper_scripts/glusterfs-precreate.sh32
1 files changed, 32 insertions, 0 deletions
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 <dir1> [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