forked from opencog/opencog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateSymLinksOCPKG.sh
executable file
·161 lines (135 loc) · 4.74 KB
/
createSymLinksOCPKG.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
GITROOT=$1
BUILDROOT=$2
INITIAL_PWD=$PWD
SEARCH_PWD=$PWD
echo "Starting symbolic link creation script..."
if ! [ -e $GITROOT ]; then
echo "Supplied GITROOT does not exist!"
exit
fi
# In case no GITROOT was supplied...
if [ -z $GITROOT ]; then
echo "Trying to locate git root..."
PWDLEN=$(echo ${#PWD})
# See if we can search upwards...
if [ $PWDLEN -gt 1 ]; then
# try to find it by going up the folder tree
while [ $PWDLEN -gt 1 ] && [ -z $GITROOT ] ; do
if [ -e ".git" ] && [ -e ${PWD}/lib/opencog.conf ]; then
GITROOT=${PWD}
else
#echo "No .git file found, going up!"
cd ..
SEARCH_PWD=$PWD
PWDLEN=$(echo ${#SEARCH_PWD})
fi
done
fi
# If we still have no GITROOT...search downwards...
if [ -z $GITROOT ]; then
echo "Unable to locate git root by going up..."
echo "Returning to initial folder $INITIAL_PWD"
echo "Trying to locate git root in subfolders..."
cd $INITIAL_PWD
# Check for ochack folder
if [ -e "ochack" ]; then
cd ochack
if [ -e ".git" ] && [ -e ${PWD}/lib/opencog.conf ]; then
GITROOT=${PWD}
fi
# Check for opencog folder
elif [ -e "opencog" ]; then
cd opencog
if [ -e ".git" ] && [ -e ${PWD}/lib/opencog.conf ]; then
GITROOT=${PWD}
else
#check for a src folder here
if [ -e "src" ]; then
cd src
if [ -e ".git" ]; then
GITROOT=${PWD}
fi
fi
fi
# Check for src folder
elif [ -e "src" ]; then
cd src
if [ -e ".git" ] && [ -e ${PWD}/lib/opencog.conf ]; then
GITROOT=${PWD}
else
#check for an opencog folder here
if [ -e "opencog" ]; then
cd opencog
# check for a src folder here
if [ -e "src" ]; then
cd src
if [ -e ".git" ] && [ -e ${PWD}/lib/opencog.conf ]; then
GITROOT=${PWD}
fi
fi
fi
fi
fi
fi
fi
if ! [ -z $GITROOT ]; then
if ! [ -z $GITROOT ]; then
# Let's go into GITROOT
echo "Moving into $GITROOT"
cd $GITROOT
# Check for and delete existing bin folder
if [ -e "bin" ]; then
echo "Found an existing bin folder, deleting..."
rm -rf bin
echo "Existing bin folder deleted!"
fi
echo "Creating folders for symbolic links..."
# Let's create the folders first
mkdir -p bin/opencog/cogserver/server
mkdir -p bin/opencog/persist/sql
mkdir -p bin/opencog/query
mkdir -p bin/opencog/cogserver/shell
mkdir -p bin/opencog/web
mkdir -p bin/opencog/learning/dimensionalembedding
mkdir -p bin/opencog/cython
mkdir -p bin/opencog/util
mkdir -p bin/opencog/nlp/types
# mkdir -p bin/opencog/viterbi
mkdir -p bin/opencog/attention
mkdir -p bin/opencog/atomspace
mkdir -p bin/opencog/spacetime
echo "Folder creation complete!"
# And then the symbolic links
# BUILDROOT = /tmp/opencog/build
# ln -s ../../../../build/opencog/cogserver/server/cogserver bin/opencog/cogserver/server/cogserver
#echo "GITROOT=$GITROOT"
if [ -z $BUILDROOT ]; then
BUILDROOT=$GITROOT/../build
fi
if ! [ -e $BUILDROOT ]; then
mkdir -p $BUILDROOT
fi
#echo "BUILDROOT=$BUILDROOT"
echo "Creating symbolic links..."
ln -s $BUILDROOT/opencog/spacetime/spacetime_types.scm bin/opencog/spacetime/spacetime_types.scm
ln -s $BUILDROOT/opencog/scm/core_types.scm bin/opencog/scm/core_types.scm
ln -s $BUILDROOT/opencog/cogserver/server/cogserver bin/opencog/cogserver/server/cogserver
ln -s $BUILDROOT/opencog/cogserver/server/libbuiltinreqs.so bin/opencog/cogserver/server/libbuiltinreqs.so
ln -s $BUILDROOT/opencog/persist/sql/libpersist.so bin/opencog/persist/sql/libpersist.so
ln -s $BUILDROOT/opencog/query/libquery.so bin/opencog/query/libquery.so
ln -s $BUILDROOT/opencog/cogserver/shell/libscheme-shell.so bin/opencog/cogserver/shell/libscheme-shell.so
ln -s $BUILDROOT/opencog/cogserver/shell/libpy-shell.so bin/opencog/cogserver/shell/libpy-shell.so
ln -s $BUILDROOT/opencog/web/libocweb.so bin/opencog/web/libocweb.so
ln -s $BUILDROOT/opencog/learning/dimensionalembedding/libdimensionalembedding.so bin/opencog/learning/dimensionalembedding/libdimensionalembedding.so
ln -s $BUILDROOT/opencog/cython/libPythonModule.so bin/opencog/cython/libPythonModule.so
ln -s $BUILDROOT/opencog/util/libcogutil.so bin/opencog/util/libcogutil.so
ln -s $BUILDROOT/opencog/nlp/types/libnlp-types.so bin/opencog/nlp/types/libnlp-types.so
ln -s $BUILDROOT/opencog/nlp/types/nlp_types.scm bin/opencog/nlp/types/nlp_types.scm
# ln -s $BUILDROOT/opencog/viterbi/libviterbi.so bin/opencog/viterbi/libviterbi.so
ln -s $BUILDROOT/opencog/attention/libattention.so bin/opencog/attention/libattention.so
ln -s $BUILDROOT/opencog/attention/attention_types.scm bin/opencog/attention/attention_types.scm
echo "Symbolic link creation complete!"
fi
else
echo "No git root folder found, try running again from inside the opencog source tree"
fi