Browse Source

réorganisation des fichiers pour construction de paquet eole

tags/pkg/dev/eole-2.7.0/0.0.1-0
Vincent Febvre 6 months ago
parent
commit
434b79595a
6 changed files with 322 additions and 43 deletions
  1. 26
    0
      Makefile
  2. 64
    0
      apps.mk
  3. 231
    0
      eole.mk
  4. 0
    0
      lib/eole/func_glust.sh
  5. 1
    1
      scripts/glusterfs_init
  6. 0
    42
      scripts/glusterfs_init.bck

+ 26
- 0
Makefile View File

@@ -0,0 +1,26 @@
1
+################################
2
+# Makefile pour eole-glusterfs
3
+################################
4
+
5
+SOURCE=eole-glusterfs
6
+VERSION=0.0.1
7
+EOLE_VERSION=2.7
8
+EOLE_RELEASE=2.7.0
9
+PKGAPPS=non
10
+
11
+################################
12
+# Début de zone à ne pas éditer
13
+################################
14
+
15
+include eole.mk
16
+include apps.mk
17
+
18
+################################
19
+# Fin de zone à ne pas éditer
20
+################################
21
+
22
+# Makefile rules dedicated to application
23
+# if exists
24
+ifneq (, $(strip $(wildcard $(SOURCE).mk)))
25
+include $(SOURCE).mk
26
+endif

+ 64
- 0
apps.mk View File

@@ -0,0 +1,64 @@
1
+# 
2
+# NE PAS EDITER CE FICHIER
3
+#
4
+# Voir Makefile
5
+
6
+
7
+##########################
8
+# Application web envole #
9
+##########################
10
+ifneq (, $(filter oui web, $(PKGAPPS)))
11
+#
12
+# Sanity check
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
20
+
21
+# Envole
22
+sharenvole_PROG_DIR			:= $(DESTDIR)/usr/share/envole/$(SOURCE)
23
+
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
27
+
28
+endif
29
+
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)')
39
+endif
40
+
41
+ifeq (, $(strip $(wildcard src/$(FLASK_MODULE).conf)))
42
+$(error missing eoleflask configuration file 'src/$(FLASK_MODULE).conf')
43
+endif
44
+
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)
48
+
49
+ifeq (, $(strip $(APPS_MOUNT_POINT)))
50
+$(error no "MOUNT_POINT" in eoleflask configuration file 'src/$(FLASK_MODULE).conf')
51
+endif
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)
58
+
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

+ 231
- 0
eole.mk View File

@@ -0,0 +1,231 @@
1
+#
2
+# NE PAS EDITER CE FICHIER
3
+#
4
+# Utiliser <appli>.mk à inclure à la fin de Makefile
5
+
6
+#################
7
+# Sanity checks #
8
+#################
9
+
10
+ifeq (, $(DESTDIR))
11
+$(warning $$(DESTDIR) is empty, installation will be done in /)
12
+endif
13
+
14
+ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE))))
15
+$(error $$(SOURCE) variable has incorrect value '$(SOURCE)')
16
+endif
17
+
18
+ifeq (, $(filter-out 2.X, $(strip $(EOLE_VERSION))))
19
+$(error $$(EOLE_VERSION) variable has incorrect value '$(EOLE_VERSION)')
20
+endif
21
+
22
+ifeq (, $(filter-out 2.X.Y, $(strip $(EOLE_RELEASE))))
23
+$(error $$(EOLE_RELEASE) variable has incorrect value '$(EOLE_RELEASE)')
24
+endif
25
+
26
+#########################
27
+# Variables definitions #
28
+#########################
29
+
30
+INSTALL                 := install
31
+INSTALL_DATA            := install -m 644
32
+INSTALL_PROGRAM         := install -m 755
33
+INSTALL_DIRECTORY       := install -m 755 -d
34
+INSTALL_RECURSIVE       := cp -dr --no-preserve=ownership
35
+
36
+# Standard path
37
+bin_PROG_DIR		:= $(DESTDIR)/usr/bin
38
+sbin_PROG_DIR		:= $(DESTDIR)/usr/sbin
39
+man8_DATA_DIR		:= $(DESTDIR)/usr/share/man/fr.UTF-8/man8
40
+
41
+# Base
42
+eole_DIR                := $(DESTDIR)/usr/share/eole
43
+
44
+ifeq ($(strip $(EOLE_VERSION)), 2.3)
45
+diagnose_PROG_DIR       := $(eole_DIR)/diagnose/module
46
+else
47
+diagnose_PROG_DIR       := $(eole_DIR)/diagnose/
48
+endif
49
+
50
+# Creole
51
+creole_DIR              := $(eole_DIR)/creole
52
+dicos_DATA_DIR          := $(creole_DIR)/dicos
53
+tmpl_DATA_DIR           := $(creole_DIR)/distrib
54
+preservice_PROG_DIR     := $(eole_DIR)/preservice
55
+pretemplate_PROG_DIR    := $(eole_DIR)/pretemplate
56
+posttemplate_PROG_DIR   := $(eole_DIR)/posttemplate
57
+postservice_PROG_DIR    := $(eole_DIR)/postservice
58
+ifeq ($(strip $(EOLE_VERSION)), 2.3)
59
+firewall_DATA_DIR       := $(eole_DIR)/firewall
60
+endif
61
+bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore
62
+bareos_restore_DATA_DIR := $(eole_DIR)/bareos/restore
63
+bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d
64
+bareos_fichier_DATA_DIR	:= $(DESTDIR)/etc/bareos/bareosfichiers.d
65
+ifeq ($(strip $(EOLE_VERSION)), 2.3)
66
+schedule_pre_PROG_DIR   := $(eole_DIR)/schedule/pre
67
+schedule_post_PROG_DIR  := $(eole_DIR)/schedule/post
68
+else
69
+schedule_scripts_PROG_DIR	:= $(eole_DIR)/schedule/scripts
70
+endif
71
+extra_REC_DIR		:= $(creole_DIR)/extra
72
+
73
+# Zéphir
74
+zephir_DATA_DIR         := $(DESTDIR)/usr/share/zephir
75
+zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
76
+zephir_srv_DATA_DIR     := $(zephir_configs_DATA_DIR)/services
77
+zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts
78
+
79
+# SSO
80
+sso_DATA_DIR            := $(DESTDIR)/usr/share/sso
81
+sso_filtres_DATA_DIR    := $(sso_DATA_DIR)/app_filters
82
+sso_user-info_DATA_DIR  := $(sso_DATA_DIR)/user_infos
83
+
84
+# EAD
85
+ead_DATA_DIR            := $(DESTDIR)/usr/share/ead2/backend/config
86
+ead_actions_DATA_DIR    := $(ead_DATA_DIR)/actions
87
+ead_perms_DATA_DIR      := $(ead_DATA_DIR)/perms
88
+ead_roles_DATA_DIR      := $(ead_DATA_DIR)/roles
89
+
90
+# Program libraries goes under /usr/lib/<PROGRAM>/
91
+lib_$(SOURCE)_DATA_DIR	:= $(DESTDIR)/usr/lib/$(SOURCE)
92
+
93
+# Scripts Eole
94
+scripts_PROG_DIR        := $(eole_DIR)/sbin
95
+lib_eole_DATA_DIR	:= $(DESTDIR)/usr/lib/eole
96
+
97
+# LDAP
98
+ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files
99
+
100
+# LXC
101
+lxc_DATA_DIR            := $(eole_DIR)/lxc
102
+lxc_fstab_DATA_DIR      := $(lxc_DATA_DIR)/fstab
103
+lxc_hosts_DATA_DIR	:= $(lxc_DATA_DIR)/hosts
104
+
105
+# SQL
106
+sql_DATA_DIR            := $(eole_DIR)/mysql/$(SOURCE)
107
+sql_gen_DATA_DIR        := $(sql_DATA_DIR)/gen
108
+sql_updates_DATA_DIR    := $(sql_DATA_DIR)/updates
109
+
110
+sql_conf_gen_DATA_DIR		:= $(eole_DIR)/applications/gen
111
+sql_conf_passwords_DATA_DIR	:= $(eole_DIR)/applications/passwords
112
+sql_conf_updates_DATA_DIR	:= $(eole_DIR)/applications/updates/$(SOURCE)
113
+
114
+# EoleDB sql directory
115
+db_DIR               := $(eole_DIR)/db
116
+db_gen_DATA_DIR      := $(eole_DIR)/db/$(SOURCE)/gen
117
+db_updates_DATA_DIR  := $(eole_DIR)/db/$(SOURCE)/updates
118
+
119
+# Certifs
120
+certs_DATA_DIR		:= $(eole_DIR)/certs
121
+
122
+# Logrotate
123
+logrotate_DATA_DIR      := $(DESTDIR)/etc/logrotate.d
124
+
125
+# Cron
126
+cron_PROG_DIR 		:= $(DESTDIR)/etc/cron.daily
127
+
128
+# Python modules
129
+ifneq ($(DESTDIR),)
130
+PYTHON_OPTS     := --root $(DESTDIR)
131
+endif
132
+
133
+# Translation
134
+TRANSLATION_SRC := translation
135
+TRANSLATION_DEST := $(DESTDIR)/usr/share/locale
136
+PO_FILES = $(wildcard $(TRANSLATION_SRC)/*/*.po)
137
+MO_FOLDERS = $(addprefix $(TRANSLATION_DEST), $(addsuffix LC_MESSAGES,$(subst $(TRANSLATION_SRC),,$(dir $(PO_FILES)))))
138
+
139
+#############################################
140
+# Common directories and files installation #
141
+#############################################
142
+
143
+all:
144
+
145
+$(MO_FOLDERS):
146
+	$(INSTALL_DIRECTORY) $@
147
+
148
+$(PO_FILES): $(MO_FOLDERS)
149
+	msgfmt -o $(TRANSLATION_DEST)$(subst $(TRANSLATION_SRC),,$(addsuffix LC_MESSAGES,$(dir $@)))/$(notdir $(@:.po=.mo)) $@
150
+
151
+install-lang: $(PO_FILES)
152
+
153
+install:: install-dirs install-files install-lang
154
+
155
+# $1 = command to run
156
+# $2 = source directory
157
+# $3 = destination directory
158
+define fc_install_file
159
+	if [ -d $2 ]; then					\
160
+		for file in `ls -1 $2/`; do			\
161
+		   $1 $2/$$file $3 || true;			\
162
+	    done;						\
163
+	fi
164
+endef
165
+
166
+##
167
+## Directory creation
168
+##
169
+
170
+# use % to catch local name in $*
171
+# data, program and recursive directory require a corresponding
172
+# directory in local sources
173
+%_DATA_DIR %_PROG_DIR %REC_DIR:
174
+	test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@)
175
+
176
+# Create the directory referenced by the variable without a local one.
177
+%_DIR:
178
+	@: # do nothing
179
+
180
+##
181
+## Install files present directly under data, program and recursive directories
182
+##
183
+
184
+# $*   : name of variable
185
+# $($*): value of variable
186
+%-instdata:
187
+	$(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*))
188
+
189
+%-instprog:
190
+	$(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*))
191
+
192
+%-instrec:
193
+	$(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*))
194
+
195
+
196
+# Use second expansion as variables may be created in included
197
+# Makefiles
198
+.SECONDEXPANSION:
199
+
200
+# List of all directories
201
+installdirs_LIST	= $(foreach V, $(filter %_DIR, $(.VARIABLES)),	\
202
+				$(if $(filter file, $(origin $(V))),	\
203
+					$(V)))
204
+# List of data directories
205
+installdata_LIST	= $(filter %_DATA_DIR, $(installdirs_LIST))
206
+# List of program directories
207
+installprog_LIST	= $(filter %_PROG_DIR, $(installdirs_LIST))
208
+# List of recursive directories
209
+installrec_LIST	 	= $(filter %_REC_DIR, $(installdirs_LIST))
210
+
211
+# Expand directories to create as dependency
212
+# Use double-colon to permit user to define additionnal install-dirs
213
+install-dirs:: $$(installdirs_LIST)
214
+
215
+# Expand files to install as dependency
216
+# Use double-colon to permit user to define additionnal install-files
217
+install-files:: install-data-files install-prog-files install-rec-dirs
218
+
219
+install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST))
220
+
221
+install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
222
+
223
+install-rec-dirs:   $$(patsubst %,%-instrec,$$(installrec_LIST))
224
+
225
+# Installation of python modules
226
+ifeq ($(shell test -f setup.py && echo 0), 0)
227
+install-files::
228
+	python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
229
+endif
230
+
231
+.PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs

scripts/func_glust.sh → lib/eole/func_glust.sh View File


+ 1
- 1
scripts/glusterfs_init View File

@@ -3,7 +3,7 @@
3 3
 if [ -f /etc/eole/config.eol ]; then
4 4
     hostname=$(CreoleGet glusterfs_servername)
5 5
     glusterfs_name=$(CreoleGet glusterfs_name)
6
-    source func_glust.sh
6
+    source /usr/lib/eole/func_glust.sh
7 7
     glusterTest
8 8
     if [[ $# != 0 ]] && [[ $1 = "test" ]]; then
9 9
         exit 0

+ 0
- 42
scripts/glusterfs_init.bck View File

@@ -1,42 +0,0 @@
1
-#!/bin/bash
2
-
3
-hostname=$(CreoleGet glusterfs_servername)
4
-glusterfs_name=$(CreoleGet glusterfs_name)
5
-found=0
6
-for name in $(CreoleGet glusterfs_remote_servername); do
7
-    [ "$name" = "$hostname" ] && found=1 && break
8
-done
9
-[ $found = 0 ] && echo "Le noeud local doit faire partie de 'glusterfs_remote_servername'" && exit 1
10
-
11
-if [ "$(gluster volume info 2>&1)" = "No volumes present" ]; then
12
-    CMD=''
13
-    idx=0
14
-    glusterfs_dirname_data=$(CreoleGet glusterfs_dirname_data)
15
-    for name in $(CreoleGet glusterfs_remote_servername); do
16
-        if [ ! "$name" = "$hostname" ]; then
17
-            gluster peer probe $name
18
-        fi
19
-        CMD="$CMD $name:$glusterfs_dirname_data/$glusterfs_name"
20
-        idx=$((idx+1))
21
-    done
22
-    echo "lancer la commande sur les autres noeuds et valider"
23
-    read a
24
-    gluster volume create $glusterfs_name replica $idx$CMD
25
-    gluster volume start $glusterfs_name
26
-fi
27
-grep "^$hostname:/$glusterfs_name" /etc/fstab
28
-if [ ! "$?" = "0" ]; then
29
-    all_server=''
30
-    for name in $(CreoleGet glusterfs_remote_servername); do
31
-        if [ ! "$name" = "$hostname" ]; then
32
-            [ ! "$all_server" = "" ] && all_server+=":"
33
-            all_server+="$name"
34
-        fi
35
-    done
36
-    destdir=$(CreoleGet glusterfs_dirname)
37
-    mkdir -p $destdir
38
-    echo "$hostname:/$glusterfs_name $destdir glusterfs backupvolfile-server=$all_server,defaults,_netdev 0 0" >> /etc/fstab
39
-    mount -a
40
-fi
41
-
42
-exit 0

Loading…
Cancel
Save