-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
60 lines (49 loc) · 1.15 KB
/
setup.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
#!/bin/bash
ts_path_default="$HOME/tigershark"
db_path_default="$HOME/tigershark_db"
db_name_default="ts1"
echo Tigershark install path
echo [default] $ts_path_default
read TS_PATH
echo DB path
echo [default] $db_path_default
read DB_PATH
echo DB name
echo [default] $db_name_default
read DB_NAME
if [ -z "$TS_PATH" ]
then
TS_PATH=$ts_path_default
fi
if [ -z "$DB_PATH" ]
then
DB_PATH=$db_path_default
fi
if [ -z "$DB_NAME" ]
then
DB_NAME=$db_name_default
fi
# add the .db extension
DB_NAME=$DB_NAME.db
echo ts_path=$TS_PATH
echo db_path=$DB_PATH
echo db_name=$DB_NAME
echo --------------------------------
read -p "Do you want to proceed? (yes/no) " yn
case $yn in
yes ) echo . . . ;;
no ) echo exiting...;
exit;;
* ) echo invalid response;
exit 1;;
esac
mkdir -p $TS_PATH
mkdir -p $DB_PATH
cp -r * $TS_PATH
sqlite3 $DB_PATH/$DB_NAME ".read db/schema.sql"
echo DB created: $DB_PATH/$DB_NAME
echo TS_DATABASE_URL=$DB_PATH/$DB_NAME > .env
echo TS_PATH and TS_DATABASE added to .bashrc
echo 'export PYTHONPATH=$PYTHONPATH:'$TS_PATH'/python' >> ~/.bashrc
echo 'export TS_DATABASE_URL='$DB_PATH'/'$DB_NAME >> ~/.bashrc
echo 'export TS_PATH='$TS_PATH >> ~/.bashrc