-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_paper_scanner_install.sh
47 lines (37 loc) · 1.55 KB
/
test_paper_scanner_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
whoami=`whoami`
# Remove because ubuntu always root, but root is not good
#if [ $(id -u) -eq 0 ]; then
# echo "Please not run as root"
# exit
#fi
# apt
sudo apt update
# required PPA
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11 -y
sudo apt -y install python3-pip
sudo pip3 install --upgrade pip
sudo pip3 install virtualenv
# deb
version=$(cat version)
sed -i "s/__version__.*/__version__ = \"$version\"/" Test_Paper_Scanner/__init__.py
python3 setup.py bdist_wheel
rm dist/scanner/Test_Paper_Scanner/*.whl
mv dist/Test_Paper_Scanner*.whl dist/scanner/Test_Paper_Scanner/
sudo mv requirements.txt dist/scanner/Test_Paper_Scanner
sudo mv dist/scanner/ /opt/
sudo mv Test_Paper_Scanner.service /etc/systemd/system/
virtualenv --python=python3.11 /opt/scanner/Test_Paper_Scanner/venv
/opt/scanner/Test_Paper_Scanner/venv/bin/python -m pip install --upgrade pip
/opt/scanner/Test_Paper_Scanner/venv/bin/pip3 install --force-reinstall /opt/scanner/Test_Paper_Scanner/Test_Paper_Scanner*
/opt/scanner/Test_Paper_Scanner/venv/bin/pip3 install -r /opt/scanner/Test_Paper_Scanner/requirements.txt
vim /opt/scanner/Test_Paper_Scanner/Test_Paper_Scanner_config.ini
cd /opt/scanner/Test_Paper_Scanner
export FLASK_APP=Test_Paper_Scanner.app
# service
sudo sed -i "s/User=.*/User=$whoami/" /etc/systemd/system/Test_Paper_Scanner.service
sudo systemctl daemon-reload
sudo systemctl enable Test_Paper_Scanner.service
sudo systemctl restart Test_Paper_Scanner.service
echo 'Test Paper Scanner server installation finished'