Commit 8be7d90c by Victor Shnayder

Address comments on #484.

parent be94e176
#!/bin/bash #!/usr/bin/env bash
# Create symlinks from ~/mitx_all/data or $ROOT/data, with root passed as first arg # 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/ # to all the test courses in mitx/common/test/data/
ROOT=$HOME/mitx_all # posix compliant sanity check
if [ -z $BASH ] || [ $BASH = "/bin/sh" ]; then
# If there is a parameter, and it's a dir, assuming that's the path to echo "Please use the bash interpreter to run this script"
# the edX root dir, with data and mitx inside it exit 1
if [ -d "$1" ]; then
ROOT=$1
fi fi
if [ ! -d "$ROOT" ]; then ROOT="${1:-$HOME/mitx_all}"
if [[ ! -d "$ROOT" ]]; then
echo "'$ROOT' is not a directory" echo "'$ROOT' is not a directory"
exit 1 exit 1
fi fi
if [ ! -d "$ROOT/mitx" ]; then if [[ ! -d "$ROOT/mitx" ]]; then
echo "'$ROOT' is not the root mitx_all directory" echo "'$ROOT' is not the root mitx_all directory"
exit 1 exit 1
fi fi
if [ ! -d "$ROOT/data" ]; then if [[ ! -d "$ROOT/data" ]]; then
echo "'$ROOT' is not the root mitx_all directory" echo "'$ROOT' is not the root mitx_all directory"
exit 1 exit 1
fi fi
...@@ -29,11 +29,15 @@ fi ...@@ -29,11 +29,15 @@ fi
echo "ROOT is $ROOT" echo "ROOT is $ROOT"
cd $ROOT/data cd $ROOT/data
for course in `ls ../mitx/common/test/data/`
for course in $(/bin/ls ../mitx/common/test/data/)
do do
# Get rid of the symlink if it already exists # Get rid of the symlink if it already exists
if [[ -L "$course" ]]; then
echo "Removing link to '$course'"
rm -f $course
fi
echo "Make link to '$course'" echo "Make link to '$course'"
rm -f "$course"
# Create it # Create it
ln -s "../mitx/common/test/data/$course" ln -s "../mitx/common/test/data/$course"
done done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment