improved ioncube package specs

This commit is contained in:
Serghey Rodin 2017-12-11 18:42:28 +02:00
commit 3615b38fbf
6 changed files with 54 additions and 8 deletions

View file

@ -1,8 +1,8 @@
#!/bin/bash
# Run triggers only on updates
if [ -e /usr/local/vesta/ioncube/add_ioncube.sh ]; then
/usr/local/vesta/ioncube/add_ioncube.sh
if [ -e /usr/local/vesta/ioncube/ioncube.sh ]; then
/usr/local/vesta/ioncube/ioncube.sh add
fi
exit 0

8
src/deb/ioncube/prerm Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
# Run triggers only on updates
if [ -e /usr/local/vesta/ioncube/ioncube.sh ]; then
/usr/local/vesta/ioncube/ioncube.sh delete
fi
exit 0

8
src/deb/php/postinst Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
# Run triggers only on updates
if [ -e /usr/local/vesta/ioncube/ioncube.sh ]; then
/usr/local/vesta/ioncube/ioncube.sh add
fi
exit 0

View file

@ -1,13 +1,28 @@
#!/bin/bash
action=${1-add}
VESTA='/usr/local/vesta'
ioncube="ioncube_loader_lin_5.6.so"
php='/usr/local/vesta/php/lib/php.ini'
# Check if extention is enabled
if [ -z "$(grep $ioncube $php |grep -v ';')" ]; then
echo "zend_extension = '$VESTA/ioncube/$ioncube'" >> $php
/etc/init.d/vesta restart
if [ ! -e "$php" ]; then
exit
fi
if [ ! -e "$VESTA/ioncube/$ioncube" ]; then
exit
fi
if [ "$action" = 'install' ]; then
if [ -z "$(grep $ioncube $php |grep -v ';')" ]; then
echo "zend_extension = '$VESTA/ioncube/$ioncube'" >> $php
/etc/init.d/vesta restart
fi
else
if [ ! -z "$(grep $ioncube $php |grep -v ';')" ]; then
sed -i "/$ioncube/d" $php
/etc/init.d/vesta restart
fi
fi
exit

View file

@ -30,10 +30,18 @@ rm -rf %{buildroot}
%post
if [ $1 -eq 1 ]; then
if [ -e /usr/local/vesta/ioncube/add_ioncube.sh ]; then
/usr/local/vesta/ioncube/add_ioncube.sh
if [ -e /usr/local/vesta/ioncube/ioncube.sh ]; then
/usr/local/vesta/ioncube/ioncube.sh add
fi
fi
%preun
if [ $1 -eq 0 ]; then
if [ -e /usr/local/vesta/ioncube/ioncube.sh ]; then
/usr/local/vesta/ioncube/ioncube.sh delete
fi
fi
%files
%{_vestadir}

View file

@ -40,6 +40,13 @@ rm -rf $RPM_BUILD_ROOT/.lock
%clean
rm -rf %{buildroot}
%post
if [ $1 -eq 1 ]; then
if [ -e /usr/local/vesta/ioncube/ioncube.sh ]; then
/usr/local/vesta/ioncube/ioncube.sh add
fi
fi
%postun
if [ $1 -ge 1 ]; then
if [ -e "/var/run/vesta-php.pid" ]; then