-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01-install
executable file
·52 lines (41 loc) · 1.06 KB
/
01-install
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
#!/bin/sh
set -e
# source common bashlib or exit
if [[ -f ${UKWACOMMONDIR}/common.sh ]]; then source ${UKWACOMMONDIR}/common.sh; else echo "ERROR: ${UKWACOMMONDIR}/common.sh missing"; exit 1; fi
NOPREFIX=1
DEBUG=
SERVICE=pywb
USER=$(id --user --name)
GROUP=$(id --group --name)
BASEDIR=/opt
PYWBDIR=${BASEDIR}/${SERVICE}
PYWBCFGDIR=/etc/${SERVICE}
# functions ----------
function install_pywb {
log DEBUG "install_pywb"
if ! [[ -d ${PYWBDIR}/ ]]; then
log INFO "Making ${PYWBDIR} directory"
sudo mkdir ${PYWBDIR}
sudo chown ${USER}:${GROUP} ${PYWBDIR}
log INFO "Create venv"
cd ${PYWBDIR}
python -m venv venv
source venv/bin/activate
log INFO "Upgrading pip"
python -m pip install --upgrade pip
log INFO "Installing pyuwb"
python -m pip install pywb
fi
[[ -d ${PYWBCFGDIR}/ ]] || sudo mkdir ${PYWBCFGDIR}
sudo chown ${USER}:${GROUP} ${PYWBDIR} ${PYWBCFGDIR}
}
function set_selinux {
log DEBUG "set_selinux"
sudo setsebool -P httpd_can_network_connect=on
}
# script -------------
ensure_not_root
install_pywb
set_selinux
copy_directory fs
log_stop