Browse Source

Mise à niveau des scripts schedule

Fixes #7419 @40m
2.4.0/master
Joël Cuissinat 5 years ago
parent
commit
e20f2af7e2
6 changed files with 138 additions and 41 deletions
  1. 5
    1
      Makefile
  2. 50
    27
      apps.mk
  3. 8
    0
      bacula/fichier/annuaire.conf
  4. 37
    13
      eole.mk
  5. 19
    0
      extra/schedule/01_annuaire.xml
  6. 19
    0
      schedule/scripts/annuaire

+ 5
- 1
Makefile View File

@@ -18,4 +18,8 @@ include apps.mk
18 18
 # Fin de zone à ne pas éditer
19 19
 ################################
20 20
 
21
-
21
+# Makefile rules dedicated to application
22
+# if exists
23
+ifneq (, $(strip $(wildcard $(SOURCE).mk)))
24
+include $(SOURCE).mk
25
+endif

+ 50
- 27
apps.mk View File

@@ -1,41 +1,64 @@
1
-# Le variables suivantes sont a votre disposition : 
1
+# 
2
+# NE PAS EDITER CE FICHIER
2 3
 #
3
-# SRC_APPS        : Répertoire des sources de l'application
4
-# SRC_APPS_PLUGIN : Répertoires des plugins pour l'application
5
-# SRC_APPS_LANG   : Répértoires des traductions
4
+# Voir Makefile
5
+
6
+
7
+##########################
8
+# Application web envole #
9
+##########################
10
+ifneq (, $(filter oui web, $(PKGAPPS)))
11
+#
12
+# Sanity check
6 13
 #
14
+ifeq (, $(filter-out X.X, $(strip $(VERSION))))
15
+$(error $$(VERSION) variable has incorrect value '$(VERSION)')
16
+endif
17
+
18
+# Where to store web application files
19
+WEB_PATH				:= $(DESTDIR)/var/www/html
7 20
 
8
-# Répertoires de destination
21
+# Envole
22
+sharenvole_PROG_DIR			:= $(DESTDIR)/usr/share/envole/$(SOURCE)
9 23
 
10
-ifeq ($(PKGAPPS),oui)
11
-#################
12
-# Sanity checks #
13
-#################
14
-test -d $(SRC_APPS) || $(error $$(PKGAPPS) is enable but $$(SRC_APPS)='$(SRC_APPS)' does not exist)
24
+src_$(SOURCE)-$(VERSION)_REC_DIR	:= $(WEB_PATH)/$(SOURCE)
25
+src_plugins-$(VERSION)_REC_DIR		:= $(WEB_PATH)/$(SOURCE)/plugin
26
+src_lang-$(VERSION)_REC_DIR		:= $(WEB_PATH)/$(SOURCE)/lang
15 27
 
16
-APPS_DEST   := $(DESTDIR)/var/www/html/$(SOURCE)
17
-LANG_DEST   := $(APPS_DEST)/lang
18
-PLUGIN_DEST := $(APPS_DEST)/plugin
19 28
 endif
20 29
 
21
-install-apps-dirs:
22
-ifeq ($(PKGAPPS),oui)
23
-	test ! -d $(SRC_APPS)           || $(INSTALL_DIRECTORY) $(APPS_DEST)
24
-	test ! -d $(SRC_APPS_LANG)      || $(INSTALL_DIRECTORY) $(LANG_DEST)
25
-	test ! -d $(SRC_APPS_PLUGIN)    || $(INSTALL_DIRECTORY) $(PLUGIN_DEST)
30
+##########################
31
+# Application EOLE flask #
32
+##########################
33
+ifneq (, $(filter flask, $(PKGAPPS)))
34
+#
35
+# Sanity check
36
+#
37
+ifeq (, $(filter-out XXX, $(strip $(FLASK_MODULE))))
38
+$(error $$(FLASK_MODULE) variable has incorrect value '$(FLASK_MODULE)')
26 39
 endif
27 40
 
28
-install-apps: install-apps-dirs
29
-ifeq ($(PKGAPPS),oui)
30
-	# Installation de l'application
31
-	$(INSTALL_RECURSIVE) $(SRC_APPS)/* $(APPS_DEST)
41
+ifeq (, $(strip $(wildcard src/$(FLASK_MODULE).conf)))
42
+$(error missing eoleflask configuration file 'src/$(FLASK_MODULE).conf')
43
+endif
32 44
 
33
-	# Installation des répertoires de plugins
34
-	$(call fc_install_file,$(INSTALL_RECURSIVE),$(SRC_APPS_PLUGIN),$(PLUGIN_DEST))
45
+# Everything is related to mount point
46
+APPS_MOUNT_POINT	:= $(shell sed -ne 's|^"MOUNT_POINT"[[:space:]]*:[[:space:]]*"/\([^"]*\)",|\1|p' \
47
+	src/$(FLASK_MODULE).conf)
35 48
 
36
-	# Installation des répertoires de traductions (lang)
37
-	$(call fc_install_file,$(INSTALL_RECURSIVE),$(SRC_APPS_LANG),$(LANG_DEST))
49
+ifeq (, $(strip $(APPS_MOUNT_POINT)))
50
+$(error no "MOUNT_POINT" in eoleflask configuration file 'src/$(FLASK_MODULE).conf')
38 51
 endif
39 52
 
53
+# eole-flask configuration
54
+src_DATA_DIR		:= $(DESTDIR)/etc/eole/flask/available
55
+
56
+# Where to store flask application files
57
+FLASK_PATH		:= $(eole_DIR)/flask/$(APPS_MOUNT_POINT)
40 58
 
41
-.PHONY: install-apps install-apps-dirs
59
+# static files
60
+src_$(FLASK_MODULE)_static_REC_DIR	:= $(FLASK_PATH)/static
61
+src_$(FLASK_MODULE)_templates_REC_DIR	:= $(FLASK_PATH)/templates
62
+src_$(FLASK_MODULE)_instance_REC_DIR	:= $(FLASK_PATH)/resources
63
+
64
+endif

+ 8
- 0
bacula/fichier/annuaire.conf View File

@@ -0,0 +1,8 @@
1
+Include {
2
+  Options {
3
+    aclsupport = no
4
+    signature = md5
5
+    @/etc/bacula/include-options.conf
6
+  }
7
+  File = /root/.reader
8
+}

+ 37
- 13
eole.mk View File

@@ -1,6 +1,7 @@
1 1
 # 
2 2
 # NE PAS EDITER CE FICHIER
3 3
 #
4
+# Utiliser <appli>.mk à inclure à la fin de Makefile
4 5
 
5 6
 #################
6 7
 # Sanity checks #
@@ -14,10 +15,6 @@ ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE))))
14 15
 $(error $$(SOURCE) variable has incorrect value '$(SOURCE)')
15 16
 endif
16 17
 
17
-ifeq (, $(filter-out X.X, $(strip $(VERSION))))
18
-$(error $$(VERSION) variable has incorrect value '$(VERSION)')
19
-endif
20
-
21 18
 #########################
22 19
 # Variables definitions #
23 20
 #########################
@@ -28,6 +25,11 @@ INSTALL_PROGRAM         := install -m 755
28 25
 INSTALL_DIRECTORY       := install -m 755 -d
29 26
 INSTALL_RECURSIVE       := cp -dr --no-preserve=ownership
30 27
 
28
+# Standard path
29
+bin_PROG_DIR		:= $(DESTDIR)/usr/bin
30
+sbin_PROG_DIR		:= $(DESTDIR)/usr/sbin
31
+man8_DATA_DIR		:= $(DESTDIR)/usr/share/man/fr.UTF-8/man8
32
+
31 33
 # Base
32 34
 eole_DIR                := $(DESTDIR)/usr/share/eole
33 35
 
@@ -45,11 +47,21 @@ pretemplate_PROG_DIR    := $(eole_DIR)/pretemplate
45 47
 posttemplate_PROG_DIR   := $(eole_DIR)/posttemplate
46 48
 postservice_PROG_DIR    := $(eole_DIR)/postservice
47 49
 firewall_DATA_DIR       := $(eole_DIR)/firewall
50
+bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore
51
+bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d
52
+ifeq ($(strip $(EOLE_VERSION)), 2.3)
53
+schedule_pre_PROG_DIR   := $(eole_DIR)/schedule/pre
54
+schedule_post_PROG_DIR  := $(eole_DIR)/schedule/post
55
+else
56
+schedule_scripts_PROG_DIR	:= $(eole_DIR)/schedule/scripts
57
+endif
58
+extra_REC_DIR		:= $(creole_DIR)/extra
48 59
 
49 60
 # Zéphir
50 61
 zephir_DATA_DIR         := $(DESTDIR)/usr/share/zephir
51
-zephir_configs_DATA_DIR := $(DESTDIR)/usr/share/zephir/monitor/configs
52
-zephir_srv_DATA_DIR     := $(zephir_DATA_DIR)/services
62
+zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
63
+zephir_srv_DATA_DIR     := $(zephir_configs_DATA_DIR)/services
64
+zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts
53 65
 
54 66
 # SSO
55 67
 sso_DATA_DIR            := $(DESTDIR)/usr/share/sso
@@ -80,19 +92,25 @@ lxc_hosts_DATA_DIR	:= $(lxc_DATA_DIR)/hosts
80 92
 # SQL
81 93
 sql_DATA_DIR            := $(eole_DIR)/mysql/$(SOURCE)
82 94
 sql_gen_DATA_DIR        := $(sql_DATA_DIR)/gen
83
-sql_updates_DATA_DIR     := $(sql_DATA_DIR)/updates
95
+sql_updates_DATA_DIR    := $(sql_DATA_DIR)/updates
84 96
 
85 97
 sql_conf_gen_DATA_DIR		:= $(eole_DIR)/applications/gen
86 98
 sql_conf_passwords_DATA_DIR	:= $(eole_DIR)/applications/passwords
87 99
 sql_conf_updates_DATA_DIR	:= $(eole_DIR)/applications/updates/$(SOURCE)
88 100
 
89
-# Envole
90
-sharenvole_PROG_DIR     := $(DESTDIR)/usr/share/envole/$(SOURCE)
101
+# Certifs
102
+certs_DATA_DIR		:= $(eole_DIR)/certs
103
+
104
+# Logrotate
105
+logrotate_DATA_DIR      := $(DESTDIR)/etc/logrotate.d
91 106
 
92
-SRC_APPS                := src/$(SOURCE)-$(VERSION)
93
-SRC_APPS_PLUGIN         := src/plugins-$(VERSION)
94
-SRC_APPS_LANG           := src/lang-$(VERSION)
107
+# Cron
108
+cron_PROG_DIR 		:= $(DESTDIR)/etc/cron.daily
95 109
 
110
+# Python modules
111
+ifneq ($(DESTDIR),)
112
+PYTHON_OPTS     := --root $(DESTDIR)
113
+endif
96 114
 
97 115
 #############################################
98 116
 # Common directories and files installation #
@@ -100,7 +118,7 @@ SRC_APPS_LANG           := src/lang-$(VERSION)
100 118
 
101 119
 all:
102 120
 
103
-install: install-dirs install-files install-apps
121
+install:: install-dirs install-files
104 122
 
105 123
 # $1 = command to run
106 124
 # $2 = source directory
@@ -172,4 +190,10 @@ install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
172 190
 
173 191
 install-rec-dirs:   $$(patsubst %,%-instrec,$$(installrec_LIST))
174 192
 
193
+# Installation of python modules
194
+ifeq ($(shell test -f setup.py && echo 0), 0)
195
+install-files::
196
+	python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
197
+endif
198
+
175 199
 .PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs

+ 19
- 0
extra/schedule/01_annuaire.xml View File

@@ -0,0 +1,19 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<creole>
4
+    <variables>
5
+        <family name='annuaire'>
6
+            <variable name="description" type="string"><value>Exportation de l'annuaire LDAP</value></variable>
7
+            <variable name="day" type="schedule"></variable>
8
+            <variable name="mode" type="schedulemod"><value>pre</value></variable>
9
+        </family>
10
+    </variables>
11
+    <constraints>
12
+        <fill name='calc_multi_condition' target='schedule.annuaire.day'>
13
+            <param>local</param>
14
+            <param type='eole' name='condition_1'>activer_client_ldap</param>
15
+            <param name='match'>daily</param>
16
+            <param name='mismatch'>none</param>
17
+        </fill>
18
+    </constraints>
19
+</creole>

+ 19
- 0
schedule/scripts/annuaire View File

@@ -0,0 +1,19 @@
1
+#!/bin/bash
2
+
3
+DESC="Exportation de l'annuaire LDAP"
4
+
5
+. /usr/share/eole/schedule/config.sh
6
+
7
+LDAPSAVDIR=$SAVDIR
8
+LDAPSAVFILE=$LDAPSAVDIR/sauv_ldap.ldif
9
+
10
+rm -f $LDAPSAVFILE
11
+mkdir -p $LDAPSAVDIR
12
+
13
+CreoleService slapd stop -c annuaire
14
+CreoleRun "slapcat -v -f /etc/ldap/slapd.conf" annuaire > $LDAPSAVFILE
15
+slapd_error=$?
16
+CreoleService slapd start -c annuaire
17
+[ $slapd_error -ne 0 ] && exit 1
18
+
19
+exit 0

Loading…
Cancel
Save