From 2aa154c903362735d8c294cc8362d3bea8a276bd Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Tue, 21 Aug 2012 15:42:47 -0400 Subject: [PATCH] Initial pass at script to create links to test dirs. --- setup-test-dirs.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 setup-test-dirs.sh diff --git a/setup-test-dirs.sh b/setup-test-dirs.sh new file mode 100644 index 0000000000..8b61e78394 --- /dev/null +++ b/setup-test-dirs.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Create symlinks from ~/mitx_all/data or $ROOT/data, with root passed as first arg +# to all the test courses in mitx/common/test/data/ + +ROOT=$HOME/mitx_all + +# If there is a parameter, and it's a dir, assuming that's the path to +# the edX root dir, with data and mitx inside it +if [ -d "$1" ]; then + ROOT=$1 +fi + +if [ ! -d "$ROOT" ]; then + echo "'$ROOT' is not a directory" + exit 1 +fi + +if [ ! -d "$ROOT/mitx" ]; then + echo "'$ROOT' is not the root mitx_all directory" + exit 1 +fi + +if [ ! -d "$ROOT/data" ]; then + echo "'$ROOT' is not the root mitx_all directory" + exit 1 +fi + +echo "ROOT is $ROOT" + +cd $ROOT/data +for course in `ls ../mitx/common/test/data/` +do + # Get rid of the symlink if it already exists + echo "Make link to '$course'" + rm -f "$course" + # Create it + ln -s "../mitx/common/test/data/$course" +done + +# go back to where we came from +cd -