-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·63 lines (44 loc) · 1.11 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
60
61
62
63
#!/bin/sh
# default setup
bold=$(tput bold)
normal=$(tput sgr0)
echo "${bold}:ncc setup:${normal}\n"
# get directory setup
echo "type CGI directory (~/wwws/cgi-bin/[input]/main.py)"
read -p "> " cgi_dir
echo "type bin directory (~/[input]/ncc)"
read -p "> " ncc_dir
ncc_path="$HOME/$ncc_dir"
if [ -z "$ncc_dir" ]; then
ncc_path="$HOME"
fi
if [ ! -e $ncc_path ]; then
mkdir -p $ncc_path;
fi
# make dir (if not exists)
cgi_path="/www/$LOGNAME/wwws/cgi-bin/$cgi_dir"
if [ -z "$cgi_dir" ]; then
cgi_path="/www/$LOGNAME/wwws/cgi-bin"
fi
if [ ! -e $cgi_path ]; then
mkdir -p $cgi_path;
fi
echo ''
cgi_url="https://cgi.u.tsukuba.ac.jp/~$LOGNAME/$cgi_dir/main.py"
if [ -z "$cgi_dir" ]; then
cgi_url="https://cgi.u.tsukuba.ac.jp/~$LOGNAME/main.py"
fi
echo "CGI path: $cgi_path/main.py"
echo "CGI URL: $cgi_url"
echo "ncc path: $ncc_path"
echo ''
echo "Copy CGI files..."
cp ./main.py $cgi_path
chmod +x $cgi_path/main.py
echo "Running make..."
cat main.cpp | sed -e "s|::CGI_PLACEHOLDER::|$cgi_url|" > _main.cpp
make -s all
mv ./ncc $ncc_path
echo "Cleaning files...\r"
make -s clean
echo "Complete!"