-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissabel-my_extension.spec
89 lines (72 loc) · 2.66 KB
/
issabel-my_extension.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
%define modname my_extension
Summary: Issabel My Extension
Name: issabel-my_extension
Version: 5.0.0
Release: 1
License: GPL
Group: Applications/System
Source0: issabel-%{modname}-%{version}.tar.gz
#Source0: %{modname}_%{version}-4.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
Requires(pre): issabel-framework >= 5.0.0-1
Requires: yum
Obsoletes: elastix-my_extension
Provides: elastix-my_extension
%description
Issabel My Extension
%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/
mv modules/ $RPM_BUILD_ROOT/var/www/html/
# 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}/
%post
# Run installer script to fix up ACLs and add module to Issabel menus.
issabel-menumerge /usr/share/issabel/module_installer/%{name}-%{version}-%{release}/menu.xml
# 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
#verificando si existe el menu en pbx
path="/var/www/db/acl.db"
path2="/var/www/db/menu.db"
men=`sqlite3 $path2 "select id from menu where id='myextension'"`
if [ $men ]; then
echo "removing menu myextension"
issabel-menuremove "myextension"
fi
res=`sqlite3 $path "select id from acl_resource where name='myex_config'"`
res2=`sqlite3 $path "select id from acl_group"`
#asignando los permisos a los grupos de usuarios para el modulo my_extension
for group in $res2
do
if [ $group != 1 ]; then
#exist registers in acl.db
val=`sqlite3 $path "select * from acl_group_permission where id_group=$group and id_resource=$res"`
if [ -z $val ]; then
echo "updating group with id=$group for default My extension module"
`sqlite3 $path "insert into acl_group_permission(id_action, id_group, id_resource) values(1,$group,$res)"`
fi
fi
done
rm -rf /tmp/new_module
%clean
rm -rf $RPM_BUILD_ROOT
%preun
if [ $1 -eq 0 ] ; then # Validation for desinstall this rpm
echo "Delete My Extension menus"
issabel-menuremove "%{modname}"
fi
%files
%defattr(-, root, root)
%{_localstatedir}/www/html/*
/usr/share/issabel/module_installer/*
%changelog