forked from CDL-Dryad/dryad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymlink_config.sh
executable file
·42 lines (34 loc) · 1019 Bytes
/
symlink_config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
mydir="../dryad-config"
CURRENTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $CURRENTDIR
if [ ! -d $mydir ]; then
echo "Copying configuration files:"
mkdir -p $mydir/config
rsync -av $CURRENTDIR/dryad-config-example/ $mydir/config
fi
echo "Symlinking..."
cd $mydir
CONFIGDIR="$( pwd )"
len=$((${#CONFIGDIR} + 1))
cd $CURRENTDIR
if [ ! -e $CURRENTDIR/config/tenants ]; then
echo "symlinking tenants"
ln -s $CONFIGDIR/config/tenants/ $CURRENTDIR/config/tenants
fi
ls $CONFIGDIR/config/*.yml | while read -r line
do
shortfn=${line:len}
fullfn="$line"
if [ -h $shortfn ]; then
echo "file $shortfn is already symlinked"
else
echo "symlinking $shortfn"
ln -s "$fullfn" "$shortfn"
fi
done
# make sure that localhost tenant gets into the dryad-config, if it's not there
if [ ! -e $CONFIGDIR/config/tenants/localhost.yml ]; then
echo "adding localhost back to tenants"
cp $CURRENTDIR/dryad-config-example/tenants/localhost.yml $CONFIGDIR/config/tenants/localhost.yml
fi