commit d8b491a195602293921c5f5ca8ce6b963f378703 Author: Benjamin Bohard Date: Tue Dec 1 10:33:56 2020 +0100 Brouillon diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab8a318 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +################################ +# Makefile pour seth-education +################################ + +SOURCE=mtes-postgresql +VERSION=2.7 +EOLE_VERSION=2.7 +EOLE_RELEASE=2.7.1 +PKGAPPS=non +#FLASK_MODULE= + +################################ +# Début de zone à ne pas éditer +################################ + +include eole.mk +include apps.mk + +################################ +# Fin de zone à ne pas éditer +################################ + +# Makefile rules dedicated to application +# if exists +ifneq (, $(strip $(wildcard $(SOURCE).mk))) +include $(SOURCE).mk +endif diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..0fe88b1 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: mtes-postgresql +Section: admin +Priority: optional +Maintainer: Cadoles +Build-Depends: debhelper (>= 11) +Standards-Version: 3.9.3 +Homepage: https://www.cadoles.com +Vcs-Git: https://forge.cadoles.com/Cadoles/mtes-postgresql +Vcs-Browser: https://forge.cadoles.com/Cadoles/mtes-posgresql + +Package: eole-mtes-postgresql +Architecture: all +Depends: ${misc:Depends} +Description: Personnalisation Cadoles pour utilisation de postgresql 11 diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..0dbd281 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,37 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: seth-education +Source: //dev-eole.ac-dijon.fr + +Files: * +Copyright: 2017 Équipe EOLE +License: CeCILL-2 + +License: CeCILL-2 + This software is governed by the CeCILL-2 license under French law and + abiding by the rules of distribution of free software. You can use, + modify and or redistribute the software under the terms of the CeCILL-2 + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info";. + . + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited + liability. + . + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + . + The fact that you are presently reading this means that you have had + knowledge of the CeCILL-2 license and that you accept its terms. + . + On Eole systems, the complete text of the CeCILL-2 License can be found + in '/usr/share/common-licenses/CeCILL-2-en'. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..18f2d64 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,3 @@ +# Set per distribution debian tag +[DEFAULT] +debian-tag = debian/eole/%(version)s diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..218df65 --- /dev/null +++ b/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/dicos/04_maj.xml b/dicos/04_maj.xml new file mode 100644 index 0000000..c716de0 --- /dev/null +++ b/dicos/04_maj.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + 1500 + + + + + + + + + + + + diff --git a/eole.mk b/eole.mk new file mode 100644 index 0000000..9730365 --- /dev/null +++ b/eole.mk @@ -0,0 +1,231 @@ +# +# NE PAS EDITER CE FICHIER +# +# Utiliser .mk à inclure à la fin de Makefile + +################# +# Sanity checks # +################# + +ifeq (, $(DESTDIR)) +$(warning $$(DESTDIR) is empty, installation will be done in /) +endif + +ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE)))) +$(error $$(SOURCE) variable has incorrect value '$(SOURCE)') +endif + +ifeq (, $(filter-out 2.X, $(strip $(EOLE_VERSION)))) +$(error $$(EOLE_VERSION) variable has incorrect value '$(EOLE_VERSION)') +endif + +ifeq (, $(filter-out 2.X.Y, $(strip $(EOLE_RELEASE)))) +$(error $$(EOLE_RELEASE) variable has incorrect value '$(EOLE_RELEASE)') +endif + +######################### +# Variables definitions # +######################### + +INSTALL := install +INSTALL_DATA := install -m 644 +INSTALL_PROGRAM := install -m 755 +INSTALL_DIRECTORY := install -m 755 -d +INSTALL_RECURSIVE := cp -dr --no-preserve=ownership + +# Standard path +bin_PROG_DIR := $(DESTDIR)/usr/bin +sbin_PROG_DIR := $(DESTDIR)/usr/sbin +man8_DATA_DIR := $(DESTDIR)/usr/share/man/fr.UTF-8/man8 + +# Base +eole_DIR := $(DESTDIR)/usr/share/eole + +ifeq ($(strip $(EOLE_VERSION)), 2.3) +diagnose_PROG_DIR := $(eole_DIR)/diagnose/module +else +diagnose_PROG_DIR := $(eole_DIR)/diagnose/ +endif + +# Creole +creole_DIR := $(eole_DIR)/creole +dicos_DATA_DIR := $(creole_DIR)/dicos +tmpl_DATA_DIR := $(creole_DIR)/distrib +preservice_PROG_DIR := $(eole_DIR)/preservice +pretemplate_PROG_DIR := $(eole_DIR)/pretemplate +posttemplate_PROG_DIR := $(eole_DIR)/posttemplate +postservice_PROG_DIR := $(eole_DIR)/postservice +ifeq ($(strip $(EOLE_VERSION)), 2.3) +firewall_DATA_DIR := $(eole_DIR)/firewall +endif +bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore +bareos_restore_DATA_DIR := $(eole_DIR)/bareos/restore +bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d +bareos_fichier_DATA_DIR := $(DESTDIR)/etc/bareos/bareosfichiers.d +ifeq ($(strip $(EOLE_VERSION)), 2.3) +schedule_pre_PROG_DIR := $(eole_DIR)/schedule/pre +schedule_post_PROG_DIR := $(eole_DIR)/schedule/post +else +schedule_scripts_PROG_DIR := $(eole_DIR)/schedule/scripts +endif +extra_REC_DIR := $(creole_DIR)/extra + +# Zéphir +zephir_DATA_DIR := $(DESTDIR)/usr/share/zephir +zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs +zephir_srv_DATA_DIR := $(zephir_configs_DATA_DIR)/services +zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts + +# SSO +sso_DATA_DIR := $(DESTDIR)/usr/share/sso +sso_filtres_DATA_DIR := $(sso_DATA_DIR)/app_filters +sso_user-info_DATA_DIR := $(sso_DATA_DIR)/user_infos + +# EAD +ead_DATA_DIR := $(DESTDIR)/usr/share/ead2/backend/config +ead_actions_DATA_DIR := $(ead_DATA_DIR)/actions +ead_perms_DATA_DIR := $(ead_DATA_DIR)/perms +ead_roles_DATA_DIR := $(ead_DATA_DIR)/roles + +# Program libraries goes under /usr/lib// +lib_$(SOURCE)_DATA_DIR := $(DESTDIR)/usr/lib/$(SOURCE) + +# Scripts Eole +scripts_PROG_DIR := $(eole_DIR)/sbin +lib_eole_DATA_DIR := $(DESTDIR)/usr/lib/eole + +# LDAP +ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files + +# LXC +lxc_DATA_DIR := $(eole_DIR)/lxc +lxc_fstab_DATA_DIR := $(lxc_DATA_DIR)/fstab +lxc_hosts_DATA_DIR := $(lxc_DATA_DIR)/hosts + +# SQL +sql_DATA_DIR := $(eole_DIR)/mysql/$(SOURCE) +sql_gen_DATA_DIR := $(sql_DATA_DIR)/gen +sql_updates_DATA_DIR := $(sql_DATA_DIR)/updates + +sql_conf_gen_DATA_DIR := $(eole_DIR)/applications/gen +sql_conf_passwords_DATA_DIR := $(eole_DIR)/applications/passwords +sql_conf_updates_DATA_DIR := $(eole_DIR)/applications/updates/$(SOURCE) + +# EoleDB sql directory +db_DIR := $(eole_DIR)/db +db_gen_DATA_DIR := $(eole_DIR)/db/$(SOURCE)/gen +db_updates_DATA_DIR := $(eole_DIR)/db/$(SOURCE)/updates + +# Certifs +certs_DATA_DIR := $(eole_DIR)/certs + +# Logrotate +logrotate_DATA_DIR := $(DESTDIR)/etc/logrotate.d + +# Cron +cron_PROG_DIR := $(DESTDIR)/etc/cron.daily + +# Python modules +ifneq ($(DESTDIR),) +PYTHON_OPTS := --root $(DESTDIR) +endif + +# Translation +TRANSLATION_SRC := translation +TRANSLATION_DEST := $(DESTDIR)/usr/share/locale +PO_FILES = $(wildcard $(TRANSLATION_SRC)/*/*.po) +MO_FOLDERS = $(addprefix $(TRANSLATION_DEST), $(addsuffix LC_MESSAGES,$(subst $(TRANSLATION_SRC),,$(dir $(PO_FILES))))) + +############################################# +# Common directories and files installation # +############################################# + +all: + +$(MO_FOLDERS): + $(INSTALL_DIRECTORY) $@ + +$(PO_FILES): $(MO_FOLDERS) + msgfmt -o $(TRANSLATION_DEST)$(subst $(TRANSLATION_SRC),,$(addsuffix LC_MESSAGES,$(dir $@)))/$(notdir $(@:.po=.mo)) $@ + +install-lang: $(PO_FILES) + +install:: install-dirs install-files install-lang + +# $1 = command to run +# $2 = source directory +# $3 = destination directory +define fc_install_file + if [ -d $2 ]; then \ + for file in `ls -1 $2/`; do \ + $1 $2/$$file $3 || true; \ + done; \ + fi +endef + +## +## Directory creation +## + +# use % to catch local name in $* +# data, program and recursive directory require a corresponding +# directory in local sources +%_DATA_DIR %_PROG_DIR %REC_DIR: + test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@) + +# Create the directory referenced by the variable without a local one. +%_DIR: + @: # do nothing + +## +## Install files present directly under data, program and recursive directories +## + +# $* : name of variable +# $($*): value of variable +%-instdata: + $(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*)) + +%-instprog: + $(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*)) + +%-instrec: + $(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*)) + + +# Use second expansion as variables may be created in included +# Makefiles +.SECONDEXPANSION: + +# List of all directories +installdirs_LIST = $(foreach V, $(filter %_DIR, $(.VARIABLES)), \ + $(if $(filter file, $(origin $(V))), \ + $(V))) +# List of data directories +installdata_LIST = $(filter %_DATA_DIR, $(installdirs_LIST)) +# List of program directories +installprog_LIST = $(filter %_PROG_DIR, $(installdirs_LIST)) +# List of recursive directories +installrec_LIST = $(filter %_REC_DIR, $(installdirs_LIST)) + +# Expand directories to create as dependency +# Use double-colon to permit user to define additionnal install-dirs +install-dirs:: $$(installdirs_LIST) + +# Expand files to install as dependency +# Use double-colon to permit user to define additionnal install-files +install-files:: install-data-files install-prog-files install-rec-dirs + +install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST)) + +install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST)) + +install-rec-dirs: $$(patsubst %,%-instrec,$$(installrec_LIST)) + +# Installation of python modules +ifeq ($(shell test -f setup.py && echo 0), 0) +install-files:: + python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS) +endif + +.PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs diff --git a/posttemplate/10-postgres b/posttemplate/10-postgres new file mode 100644 index 0000000..90fdb28 --- /dev/null +++ b/posttemplate/10-postgres @@ -0,0 +1,37 @@ +#!/bin/bash + +OLD_VERS="10" +NEW_VERS="11" + +if ! [ -x /usr/bin/pg_dropcluster ];then + exit 0 +fi + +NEW_PACKAGES="$(dpkg-query -W -f='${Package}\t${Status}\n' postgresql*-${NEW_VERS} | awk '/ok installed/ {print $1}')" +OLD_PACKAGES="$(dpkg-query -W -f='${Package}\t${Status}\n' postgresql*-${OLD_VERS} | awk '/ok installed/ {print $1}')" +# Si les deux versions (10 et 11) sont présente, on lance la migration et on supprime la version 10 +if [ -n "${OLD_PACKAGES}" ] && [ -n "${NEW_PACKAGES}" ]; then + echo "POUET" + exit 0 + # Démarrage du service + systemctl start postgresql + + # Suppression du cluster 11 créé automatiquement + pg_dropcluster --stop ${NEW_VERS} main + + # Mise à niveau du cluster avec pg_upgradecluster 10 main + pg_upgradecluster -v ${NEW_VERS} ${OLD_VERS} main + + + # suppression du cluster 10 + pg_dropcluster --stop ${OLD_VERS} main + + + # s’assurer que postgresql est démarré + systemctl start postgresql + + # désintallation de postgresql 10 + apt-eole remove ${OLD_PACKAGES} +fi + +exit 0