Skip to content

Commit 0fa457f

Browse files
author
Jordi Clariana
committed
Fix postinst script
1 parent 6a75653 commit 0fa457f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

debian/postinst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
#!/bin/bash
22

3-
ourname=fastlz
3+
PHP_VERSION=$(/usr/bin/php-config --version)
4+
PHP_VERSION_MAJOR=$(echo ${PHP_VERSION} | sed -r 's/^([0-9]+)\..*$/\1/')
5+
PHP_VERSION_MINOR=$(echo ${PHP_VERSION} | sed -r 's/^[0-9]+\.([0-9]+).*$/\1/')
46

5-
if [ -d /etc/php5/conf.d ]; then
7+
ourname=fastlz
68

7-
# check whether we have the new-style layout (php 5.4)
9+
# check whether we have the new-style layout (php 5.4)
10+
if [ ${PHP_VERSION_MAJOR} -eq 5 ] && [ ${PHP_VERSION_MINOR} -ge 4 ]; then
11+
[ ! -d /etc/php5/mods-available ] && { echo "Error: no /etc/php5/mods-available dir found"; exit 1; }
812

9-
if [ -d /etc/php5/mods-available ]; then
10-
1113
# remove legacy file if found
1214
[ -e "/etc/php5/conf.d/${ourname}.ini" ] && rm "/etc/php5/conf.d/${ourname}.ini"
1315

1416
# install new file only if not present already
15-
if [ -d /etc/php5/mods-available ] && [ ! -e "/etc/php5/mods-available/${ourname}.ini" ]; then
17+
if [ ! -e "/etc/php5/mods-available/${ourname}.ini" ]; then
1618
echo "extension=${ourname}.so" > "/etc/php5/mods-available/${ourname}.ini"
1719
php5enmod "${ourname}"
1820
fi
19-
20-
else
21-
21+
else
2222
# old style, directly in conf.d
23+
[ ! -d /etc/php5/conf.d ] && { echo "Error: no /etc/php5/conf.d dir found"; exit 1; }
24+
2325
if [ ! -e "/etc/php5/conf.d/${ourname}.ini" ]; then
2426
echo "extension=${ourname}.so" > "/etc/php5/conf.d/${ourname}.ini"
2527
fi
26-
27-
fi
28-
2928
fi
3029

3130
exit 0
31+

0 commit comments

Comments
 (0)