Răsfoiți Sursa

improved ioncube package specs

Serghey Rodin 8 ani în urmă
părinte
comite
3615b38fbf

+ 2 - 2
src/deb/ioncube/postinst

@@ -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 - 0
src/deb/ioncube/prerm

@@ -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 - 0
src/deb/php/postinst

@@ -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

+ 19 - 4
src/rpm/conf/ioncube.sh

@@ -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

+ 10 - 2
src/rpm/specs/vesta-ioncube.spec

@@ -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}
 

+ 7 - 0
src/rpm/specs/vesta-php.spec

@@ -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