1
0
forked from ScoDoc/ScoDoc

install script avec venv

This commit is contained in:
Emmanuel Viennet 2021-08-24 18:55:58 +02:00
parent 652599aa40
commit 9e441232a4
5 changed files with 34 additions and 17 deletions

View File

@ -7,7 +7,7 @@ die() {
} }
PACKAGE_NAME=scodoc9 PACKAGE_NAME=scodoc9
RELEASE_TAG=9.0.0 RELEASE_TAG=9.0.0-b
VERSION=9.0.0 VERSION=9.0.0
RELEASE=1 RELEASE=1
ARCH="amd64" ARCH="amd64"
@ -52,6 +52,17 @@ cp -p "$SCODOC_DIR"/tools/etc/scodoc9.service "$slash"/etc/systemd/system/ || di
mv "$SCODOC_DIR"/tools/debian "$slash"/DEBIAN || die "can't install DEBIAN dir" mv "$SCODOC_DIR"/tools/debian "$slash"/DEBIAN || die "can't install DEBIAN dir"
chmod 755 "$slash"/DEBIAN/*inst || die "can't chmod debian scripts" chmod 755 "$slash"/DEBIAN/*inst || die "can't chmod debian scripts"
# ------------ CREATION DU VIRTUALENV
echo "Creating python3 virtualenv..."
(cd $SCODOC_DIR && python3 -m venv venv) || die "error creating Python 3 virtualenv"
# ------------ INSTALL DES PAQUETS PYTHON (3.9)
# pip in our env, as user "scodoc"
(cd $SCODOC_DIR && source venv/bin/activate && pip install wheel && pip install -r requirements-3.9.txt) || die "Error installing python packages"
# -------- THE END
echo "Terminé."
echo "Après vérification, construire le paquet .deb avec:"
echo " dpkg-deb --build --root-owner-group $DEST_DIR"

View File

@ -9,7 +9,8 @@ source /opt/scodoc/tools/config.sh
source /opt/scodoc/tools/utils.sh source /opt/scodoc/tools/utils.sh
# -- Création au besoin de notre utilisateur # -- Création au besoin de notre utilisateur
adduser --system "${SCODOC_USER}" # adduser --system "${SCODOC_USER}"
check_create_scodoc_user
# -- Répertoires /opt/scodoc donné à scodoc # -- Répertoires /opt/scodoc donné à scodoc
change_scodoc_file_ownership change_scodoc_file_ownership

View File

@ -3,17 +3,23 @@
# Pre-installation de scodoc # Pre-installation de scodoc
# ------------ Safety checks # ------------ Safety checks
# Version majeure de Debian (..., 9, 10) # Version majeure de Debian (..., 9, 10, 11)
if [ -e /etc/debian_version ]
then
debian_version=$(cat /etc/debian_version) debian_version=$(cat /etc/debian_version)
debian_version=${debian_version%%.*} debian_version=${debian_version%%.*}
if [ "${debian_version}" != "11" ] echo "Detected Debian version: ${debian_version}"
then else
echo "Version du systeme Linux Debian incompatible" echo "can't detect Debian version"
exit 1
fi fi
#
echo arch="$(arch)"
if [ "$(arch)" != "x86_64" ] # if [ "$(arch)" != "x86_64" ]
then # then
echo "Version du systeme Linux Debian incompatible (pas X86 64 bits)" # echo
exit 1 # echo "Version du systeme Linux Debian incompatible (pas X86 64 bits)"
fi # echo
# exit 1
# fi

View File

@ -78,7 +78,7 @@ su -c "(cd $SCODOC_DIR && python3 -m venv venv)" scodoc || die "can't create Pyt
# ------------ INSTALL DES PAQUETS PYTHON (3.9) # ------------ INSTALL DES PAQUETS PYTHON (3.9)
# pip in our env, as user "scodoc" # pip in our env, as user "scodoc"
su -c "(cd $SCODOC_DIR && source venv/bin/activate && pip install wheel && pip install -r requirements-3.9.txt)" || die "Error installing python packages" su -c "(cd $SCODOC_DIR && source venv/bin/activate && pip install wheel && pip install -r requirements-3.9.txt)" scodoc || die "Error installing python packages"
# pip install --upgrade pip => bug [Errno 39] Directory not empty: '_internal' # pip install --upgrade pip => bug [Errno 39] Directory not empty: '_internal'
# ------------ # ------------

View File

@ -60,7 +60,6 @@ init_postgres_user() { # run as root
} }
# --- Ensure Unix user "scodoc" exists # --- Ensure Unix user "scodoc" exists
# note: le paquet debian utilise directement adduser --system
check_create_scodoc_user() { check_create_scodoc_user() {
if ! id -u "${SCODOC_USER}" &> /dev/null if ! id -u "${SCODOC_USER}" &> /dev/null
then then