forked from ScoDoc/DocScoDoc
scripts pour paquet Debian
This commit is contained in:
parent
5f428c1649
commit
18d6b63569
22
README.md
22
README.md
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
(c) Emmanuel Viennet 1999 - 2021 (voir LICENCE.txt)
|
(c) Emmanuel Viennet 1999 - 2021 (voir LICENCE.txt)
|
||||||
|
|
||||||
|
VERSION EXPERIMENTALE - NE PAS DEPLOYER - TESTS EN COURS
|
||||||
|
|
||||||
Installation: voir instructions à jour sur <https://scodoc.org>
|
Installation: voir instructions à jour sur <https://scodoc.org>
|
||||||
|
|
||||||
@ -267,3 +268,24 @@ base de données (tous les départements, et les utilisateurs) avant de commence
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Paquet debian 11
|
||||||
|
|
||||||
|
Ce que le script d'installation du paquet ne fait pas:
|
||||||
|
|
||||||
|
- démarrer redis `systemctl start redis` (mettre dans la doc)
|
||||||
|
|
||||||
|
- démarrer le firewall (proposer script à part)
|
||||||
|
|
||||||
|
ufw default deny incoming
|
||||||
|
ufw default allow outgoing
|
||||||
|
ufw allow ssh
|
||||||
|
ufw allow https
|
||||||
|
yes | ufw enable
|
||||||
|
|
||||||
|
- générer les certificats auto-signés (proposer script à part)
|
||||||
|
|
||||||
|
- démarrer nginx: `systemctl restart nginx` (mettre dans la doc)
|
||||||
|
|
||||||
|
- mise à jour hebdomadaire (à faire)
|
||||||
|
|
||||||
|
- migrations flask (à faire)
|
5
tools/debian/README.md
Normal file
5
tools/debian/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Fichiers pour la fabrication du paquet Debian.
|
||||||
|
|
||||||
|
Ce contenu sera copié dans `<packagename>/DEBIAN`.
|
||||||
|
|
||||||
|
|
7
tools/debian/control
Normal file
7
tools/debian/control
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Package: scodoc9
|
||||||
|
Version: 9.0.0
|
||||||
|
Architecture: amd64
|
||||||
|
Maintainer: Emmanuel Viennet <emmanuel@viennet.net>
|
||||||
|
Description: ScoDoc 9
|
||||||
|
Un logiciel pour le suivi de la scolarité universitaire.
|
||||||
|
Depends: adduser, curl, gcc, graphviz, libpq-dev, postfix, libcrack2-dev, python3-dev, python3-venv, python3-pip, python3-wheel, nginx, postgresql, redis, ufw
|
38
tools/debian/postinst
Normal file
38
tools/debian/postinst
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Post-installation de scodoc
|
||||||
|
# ici, le répertoire /opt/scodoc vient d'être installé
|
||||||
|
|
||||||
|
# On peut donc charger la config:
|
||||||
|
cd /opt/scodoc
|
||||||
|
source /opt/scodoc/tools/config.sh
|
||||||
|
source /opt/scodoc/tools/utils.sh
|
||||||
|
|
||||||
|
# -- Création au besoin de notre utilisateur
|
||||||
|
adduser --system "${SCODOC_USER}"
|
||||||
|
|
||||||
|
# -- Répertoires /opt/scodoc donné à scodoc
|
||||||
|
change_scodoc_file_ownership
|
||||||
|
# --- Création au bseoin de /opt/scodoc-data
|
||||||
|
set_scodoc_var_dir
|
||||||
|
|
||||||
|
# ------------ LOCALES (pour compat bad ScoDoc 7)
|
||||||
|
locname="en_US.UTF-8"
|
||||||
|
outname=$(echo ${locname//-/} | tr '[A-Z]' '[a-z]')
|
||||||
|
if [ "$(locale -a | grep -E -i ^${outname}$ | wc -l)" -lt 1 ]
|
||||||
|
then
|
||||||
|
echo adding $locname
|
||||||
|
echo "$locname ${locname##*.}" >> /etc/locale.gen
|
||||||
|
/usr/sbin/locale-gen --keep-existing
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCODOC_RELEASE=$(grep SCOVERSION sco_version.py | awk '{ print substr($3, 2, length($3)-2) }')
|
||||||
|
SVERSION=$(curl --silent http://scodoc.iutv.univ-paris13.fr/scodoc-installmgr/version?mode=install\&release="$SCODOC_RELEASE")
|
||||||
|
echo "$SVERSION" > "${SCODOC_VERSION_DIR}/scodoc.sn"
|
||||||
|
|
||||||
|
# --- POSTGRESQL
|
||||||
|
# --- Ensure postgres user "scodoc" ($POSTGRES_USER) exists
|
||||||
|
init_postgres_user
|
||||||
|
|
||||||
|
# --- SYSTEMD: on a installé un fichier de service
|
||||||
|
systemctl daemon-reload
|
16
tools/debian/preinst
Normal file
16
tools/debian/preinst
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Pre-installation de scodoc
|
||||||
|
|
||||||
|
# ------------ Safety checks
|
||||||
|
if [ "${debian_version}" != "11" ]
|
||||||
|
then
|
||||||
|
echo "Version du systeme Linux Debian incompatible"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(arch)" != "x86_64" ]
|
||||||
|
then
|
||||||
|
echo "Version du systeme Linux Debian incompatible (pas X86 64 bits)"
|
||||||
|
exit 1
|
||||||
|
fi
|
@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
echo "ne plus utiliser ce script"
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
# Le répertoire de ce script:
|
# Le répertoire de ce script:
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ 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
|
||||||
@ -80,7 +81,7 @@ change_scodoc_file_ownership() {
|
|||||||
set_scodoc_var_dir() {
|
set_scodoc_var_dir() {
|
||||||
echo "Checking $SCODOC_VAR_DIR..."
|
echo "Checking $SCODOC_VAR_DIR..."
|
||||||
[ -d "$SCODOC_VAR_DIR" ] || mkdir "$SCODOC_VAR_DIR" || die "can't create $SCODOC_VAR_DIR directory"
|
[ -d "$SCODOC_VAR_DIR" ] || mkdir "$SCODOC_VAR_DIR" || die "can't create $SCODOC_VAR_DIR directory"
|
||||||
for d in archives photos tmp log config config/version config/depts config/logos
|
for d in archives photos tmp log config certs config/version config/depts config/logos
|
||||||
do
|
do
|
||||||
[ -d "$SCODOC_VAR_DIR/$d" ] || mkdir "$SCODOC_VAR_DIR/$d" || die "can't create $SCODOC_VAR_DIR/$d subdirectory"
|
[ -d "$SCODOC_VAR_DIR/$d" ] || mkdir "$SCODOC_VAR_DIR/$d" || die "can't create $SCODOC_VAR_DIR/$d subdirectory"
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user