comparison setup.sh @ 91:9f3d2d765a0f

Make sure we create parent directories
author IBBoard <dev@ibboard.co.uk>
date Mon, 02 Apr 2018 17:29:52 +0100
parents b989099cde9f
children c3320f06d412
comparison
equal deleted inserted replaced
90:4342e7b19fa8 91:9f3d2d765a0f
6 if [ "${SOURCEFILE:0:1}" != "/" ]; then 6 if [ "${SOURCEFILE:0:1}" != "/" ]; then
7 SOURCEFILE=$SCRIPTPATH/$1 7 SOURCEFILE=$SCRIPTPATH/$1
8 fi 8 fi
9 parent_dir=$(dirname "$2") 9 parent_dir=$(dirname "$2")
10 if [ ! -d "$parent_dir" ]; then 10 if [ ! -d "$parent_dir" ]; then
11 mkdir "$parent_dir" 11 mkdir -p "$parent_dir"
12 fi 12 fi
13 if [ ! -e $2 ]; then 13 if [ ! -e $2 ]; then
14 ln -s $SOURCEFILE $2 14 ln -s $SOURCEFILE $2
15 elif [ "$(readlink $2)" != "$SCRIPTPATH/$1" ]; then 15 elif [ "$(readlink $2)" != "$SCRIPTPATH/$1" ]; then
16 echo "Unable to link $1 config - $2 already existed" >&2 16 echo "Unable to link $1 config - $2 already existed" >&2