-
Notifications
You must be signed in to change notification settings - Fork 0
/
initialize_project.sh
executable file
·83 lines (63 loc) · 2 KB
/
initialize_project.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
#!/usr/local/bin/bash
# Author: Naeem Khoshnevis
# Last update: Dec 10, 2021
# Note:
# shebang for linux system #!/bin/bash
# shebang for macOS system #!/usr/local/bin/bash
#
# You may need to install bash on new macOS (brew install bash)
# This script requires bash version 4.0 or higher.
# Read Parameters
declare -A v=( )
filename="project_path_info.md"
while read line
do
# $line variable contains current line read from the file
# display $line text on the screen or do something with it.
key=`echo $line | cut -d "=" -f1`
val=`echo $line | cut -d "=" -f2`
if [ -z "$key" ]
then
echo $key
else
v[$key]=$val
fi
done < $filename
echo " *** Warning *** "
echo " "
echo "This script should be run once per project per system."
echo "It is important to understand its purpose. Although running this script will update all linkers, It is important to make sure that you know which project you are wokring on. Please enter the project name and hit enter button: "
read pr_name
echo ${v[PROJECT_NAME]}
echo $pr_name
if [ `echo ${v[PROJECT_NAME]}` = `echo $pr_name` ]; then
echo "project name is correct, updating linkers ... "
else
echo "project name is not correct."
exit 1
fi;
if [ -d data ]
then
echo "data folder exists, removing old symbolic links (if any) ... "
rm data/public
rm data/private
echo "Done with removing old links for data folder."
else
echo "Creating data folder ... "
mkdir data
fi
if [ -d output ]
then
echo "output folder exists, removing old symbolic links (if any) ... "
rm -rf output
echo "Done with removing old links for output folder."
fi
echo ${v[PUBLIC_DATA_DIR]}
echo ${v[PRIVATE_DATA_DIR]}
echo ${v[OUTPUT_DATA_DIR]}
ln -s `echo ${v[PUBLIC_DATA_DIR]}` data/public
ln -s `echo ${v[PRIVATE_DATA_DIR]}` data/private
ln -s `echo ${v[OUTPUT_DATA_DIR]}` output
echo $(pwd) > pr_hard_path_name.txt
echo ${v[PROJECT_NAME]} >> pr_hard_path_name.txt
echo "Done!"