-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·50 lines (43 loc) · 1.11 KB
/
install.sh
File metadata and controls
executable file
·50 lines (43 loc) · 1.11 KB
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
#!/usr/bin/env bash
#set -e
which python3 1>/dev/null 2>&1
if [ $? -ne 0 ];then
echo "Currently TDDISH only works with python3"
exit 1
fi
import_path=`python3 -c "import sys;print(sys.path[-1] + '/tddish')"`
cli_path="/usr/local/bin/"
# copy the tddish.py as module
mkdir $import_path 1>/dev/null 2>&1
if [ $? -ne 0 ];then
echo "$import_path is already there."
echo -n "Overwrite it [y|n]:"
read -r choice
if [ -z "$choice" ] || [ "$choice" != "y" ]; then
echo "Installation aborted."
exit 1
fi
fi
import_path=$import_path"/"
cp ./tddish.py __init__.py $import_path
if [ $? -ne 0 ];then
echo "Unable to copy files to "$import_path\
". Try running the script as sudo e.g. > sudo ./install.sh"
exit 1
fi
echo "Files copied to "$import_path":"
echo "__init__.py"
echo "tddish.py"
# copy tddish as cli app to the cli_path
cp ./tddish.py ./tddish
chmod 777 ./tddish
cp ./tddish $cli_path
if [ $? -ne 0 ];then
echo "Unable to copy files to "$cli_path\
". Try running the script as sudo e.g. > sudo ./install.sh"
exit 1
fi
echo "Files copied to "$cli_path":"
echo "tddish"
rm ./tddish
echo "Installation done!."