-
Notifications
You must be signed in to change notification settings - Fork 142
/
install.sh
executable file
·58 lines (55 loc) · 2.04 KB
/
install.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
################################################################################
# File: install.sh
# Function: install docbao crawler in Ubuntu/Rasp OS
# Created date: 30/08/2020
#################################################################################
echo "INSTALL DOCBAO ON UBUNTU/RASPBERRY PI"
echo "__________________________________________________________________________"
echo "IMPORTANT!!!"
echo "REMEMBER TO RUN source SETTINGS.env BEFORE RUN THIS SCRIPT !!!"
set -a
source SETTINGS.env
set +a
export install_dir=$DOCBAO_BASE_DIR
export PYTHONPATH=$PYTHONPATH:$local_dir
cd $install_dir
sleep 1
echo "Step 1: Ensure python3, pip3, venv, curl and php are installed"
echo "__________________________________________________________________________"
sleep 1
sudo apt update
sudo apt install python3
sudo apt install python3-pip
sudo apt-get install python3-venv
sudo apt install curl
sudo apt install php7.2-cli
sudo apt install php7.2-mbstring
sleep 1
echo "Step 2: activate docbao virtual environment & install libraries"
echo "__________________________________________________________________________"
sleep 1
cd $install_dir
python3 -m venv docbao_env
source $install_dir/docbao_env/bin/activate
$install_dir/docbao_env/bin/python3 -m pip install -r requirements.txt
sleep 1
echo "Step 3: install firefox and xvfb"
echo "__________________________________________________________________________"
sleep 1
sudo apt install firefox
sudo apt install xvfb
sleep 1
echo "Step 4: copy resources files"
echo "__________________________________________________________________________"
sleep 1
sudo cp $install_dir/resources/firefox_driver/ubuntu/geckodriver /usr/bin
cp $install_dir/resources/firefox_extension/adblock.xpi $install_dir/src/backend/input
cp $install_dir/resources/configs/templates/default/config.yaml $install_dir/src/backend/input
sleep 1
echo "Step 5: run test"
echo "__________________________________________________________________________"
sleep 1
cd $install_dir/src/backend
$install_dir/docbao_env/bin/python3 test.py
sleep 1
echo "Finish !"