-
Notifications
You must be signed in to change notification settings - Fork 13
/
issabel-system.spec
188 lines (147 loc) · 5.47 KB
/
issabel-system.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
%define modname system
Name: issabel-system
Summary: Issabel System Module
Version: 5.0.0
Release: 3
License: GPL
Group: Applications/System
Source0: issabel-%{modname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
Requires(pre): issabel-framework >= 5.0.0-1
#Requires(pre): issabel-fax >= 2.2.0-4
Requires(pre): php-soap
Requires(pre): dahdi
Conflicts: elastix-agenda < 2.2.0-1
Conflicts: elastix-pbx <= 2.4.0-15
Requires: dhcp
Requires: php-simplepie
Requires: hdparm
Obsoletes: elastix-system
# commands: /bin/date /usr/bin/stat /usr/bin/du rm /bin/chown /bin/su /bin/df
Requires: coreutils
# commands: /sbin/dmsetup
Requires: device-mapper
# commands: rpm
Requires: rpm
# commands: yum
Requires: yum
# commands: /sbin/ip
Requires: iproute
# commands: /sbin/route
Requires: net-tools
# netconfig assumes postfix service is present
Requires: postfix
# dhcpconfig assumes dhcpd service is present
Requires: dhcp
# commands: chkconfig
Requires: chkconfig
# commands: tar
Requires: tar
# commands: mysqldump mysql
Requires: mariadb
# commands: /usr/lib/cyrus-imapd/reconstruct
Requires: cyrus-imapd
Requires: /usr/sbin/saslpasswd2
Requires: /sbin/pidof
Requires: /bin/hostname
Requires: /sbin/shutdown
%description
Issabel System Module
%prep
%setup -n %{name}-%{version}
%install
rm -rf $RPM_BUILD_ROOT
# Files provided by all Issabel modules
mkdir -p $RPM_BUILD_ROOT/var/www/html/
mkdir -p $RPM_BUILD_ROOT/var/www/html/libs/
mkdir -p $RPM_BUILD_ROOT/var/www/backup
mkdir -p $RPM_BUILD_ROOT/usr/share/issabel/privileged
mkdir -p $RPM_BUILD_ROOT/var/www/db/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
rm -rf modules/userlist/
mv modules/ $RPM_BUILD_ROOT/var/www/html/
mv setup/paloSantoNetwork.class.php $RPM_BUILD_ROOT/var/www/html/libs/
mv setup/automatic_backup.php $RPM_BUILD_ROOT/var/www/backup/
mv setup/usr/share/issabel/privileged/* $RPM_BUILD_ROOT/usr/share/issabel/privileged
rmdir setup/usr/share/issabel/privileged setup/usr/share/issabel setup/usr/share
# Additional (module-specific) files that can be handled by RPM
#mkdir -p $RPM_BUILD_ROOT/opt/issabel/
#mv setup/dialer
# ** Dahdi files **#
mkdir -p $RPM_BUILD_ROOT/etc/dahdi
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
# ** switch_wanpipe_media file ** #
mv setup/usr/sbin/switch_wanpipe_media $RPM_BUILD_ROOT/usr/sbin/
mv setup/usr/sbin/issabel_migration.sh $RPM_BUILD_ROOT/usr/sbin/
mv setup/usr/sbin/issabel_migration_fpbx.sh $RPM_BUILD_ROOT/usr/sbin/
rmdir setup/usr/sbin
rmdir setup/usr
# The following folder should contain all the data that is required by the installer,
# that cannot be handled by RPM.
mkdir -p $RPM_BUILD_ROOT/usr/share/issabel/module_installer/%{name}-%{version}-%{release}/
mv setup/ $RPM_BUILD_ROOT/usr/share/issabel/module_installer/%{name}-%{version}-%{release}/
mv menu.xml $RPM_BUILD_ROOT/usr/share/issabel/module_installer/%{name}-%{version}-%{release}/
%pre
mkdir -p /usr/share/issabel/module_installer/%{name}-%{version}-%{release}/
touch /usr/share/issabel/module_installer/%{name}-%{version}-%{release}/preversion_%{modname}.info
if [ $1 -eq 2 ]; then
rpm -q --queryformat='%{VERSION}-%{RELEASE}' %{name} > /usr/share/issabel/module_installer/%{name}-%{version}-%{release}/preversion_%{modname}.info
fi
%post
pathModule="/usr/share/issabel/module_installer/%{name}-%{version}-%{release}"
# Run installer script to fix up ACLs and add module to Issabel menus.
issabel-menumerge $pathModule/menu.xml
pathSQLiteDB="/var/www/db"
mkdir -p $pathSQLiteDB
preversion=`cat $pathModule/preversion_%{modname}.info`
rm $pathModule/preversion_%{modname}.info
if [ $1 -eq 1 ]; then #install
# The installer database
issabel-dbprocess "install" "$pathModule/setup/db"
if [ -f /etc/dahdi/genconf_parameters ]; then
# ** The following selects oslec as default echo canceller ** #
echo "echo_can oslec" > /etc/dahdi/genconf_parameters
echo "bri_sig_style bri" >> /etc/dahdi/genconf_parameters
echo "context_lines from-pstn" >> /etc/dahdi/genconf_parameters
echo "context_phones default" >> /etc/dahdi/genconf_parameters
fi
elif [ $1 -eq 2 ]; then #update
issabel-dbprocess "update" "$pathModule/setup/db" "$preversion"
fi
# If openfire is not running probably we're in the distro installation process
# So, i configure openfire init script as stopped by default
/sbin/service openfire status | grep "not running" &>/dev/null
res=$?
# Openfire esta apagado
if [ $res -eq 0 ]; then
# Desactivo el servicio openfire al inicio
chkconfig --level 2345 openfire off
fi
# The installer script expects to be in /tmp/new_module
mkdir -p /tmp/new_module/%{modname}
cp -r /usr/share/issabel/module_installer/%{name}-%{version}-%{release}/* /tmp/new_module/%{modname}/
chown -R asterisk.asterisk /tmp/new_module/%{modname}
php /tmp/new_module/%{modname}/setup/installer.php
rm -rf /tmp/new_module
%clean
rm -rf $RPM_BUILD_ROOT
%preun
pathModule="/usr/share/issabel/module_installer/%{name}-%{version}-%{release}"
if [ $1 -eq 0 ] ; then # Validation for desinstall this rpm
echo "Delete System menus"
issabel-menuremove "%{modname}"
echo "Dump and delete %{name} databases"
issabel-dbprocess "delete" "$pathModule/setup/db"
fi
%files
%defattr(-, root, root)
%{_localstatedir}/www/html/*
/usr/share/issabel/module_installer/*
/var/www/backup/automatic_backup.php
%defattr(755, root, root)
/usr/sbin/switch_wanpipe_media
/usr/sbin/issabel_migration.sh
/usr/sbin/issabel_migration_fpbx.sh
/usr/share/issabel/privileged/*
%changelog