Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration file handling in .deb packages #91

Open
szepeviktor opened this issue Jul 27, 2015 · 0 comments
Open

Configuration file handling in .deb packages #91

szepeviktor opened this issue Jul 27, 2015 · 0 comments

Comments

@szepeviktor
Copy link

Thank you for packaging suhosin!

Please consider using ucf for the configuration file.

I think it takes one line in the source package:
http://security.debian.org/debian-security/pool/updates/main/p/php5/php5_5.6.9+dfsg-0+deb8u1.debian.tar.xz

And that becomes:
http://security.debian.org/debian-security/pool/updates/main/p/php5/php5-mysqlnd_5.6.9+dfsg-0+deb8u1_amd64.deb

#!/bin/sh

set -e

if [ "$1" = "configure" ]; then
    ucf /usr/share/php5/mysqlnd/mysqlnd.ini /etc/php5/mods-available/mysqlnd.ini
fi

dpkg-maintscript-helper mv_conffile /etc/php5/conf.d/10-mysqlnd.ini /etc/php5/mods-available/mysqlnd.ini 5.4.0~rc6-1 -- "$@";

if [ "$1" = "configure" ]; then
    inidir=/etc/php5/mods-available

    if [ -e /usr/share/php5/php5-maintscript-helper ] ; then
    . /usr/share/php5/php5-maintscript-helper

    for dsoname in mysqlnd mysql mysqli pdo_mysql ; do
        inifile=${dsoname}.ini

        # Register new conffile with UCF
        ucf /usr/share/php5/mysqlnd/${inifile} ${inidir}/${inifile}
        ucfr --force php5-mysqlnd ${inidir}/${inifile}

        # Move pre-extension manager conffile
        dpkg-maintscript-helper mv_conffile /etc/php5/conf.d/${inifile} ${inidir}/${inifile} 5.4.0~rc6-1 -- "$@";

        if [ -f "${inidir}/${inifile}.dpkg-new" ]; then
        md5sum="$(md5sum ${inidir}/${inifile}.dpkg-new | sed -e 's/ .*//')"
        old_md5sum="$(md5sum ${inidir}/${inifile} | sed -e 's/ .*//')"
        if [ "$md5sum" = "$old_md5sum" ]; then
            mv "${inidir}/${inifile}.dpkg-new" "${inidir}/${inifile}"
        fi
        fi

        php5_invoke enmod ALL ${dsoname}
    done
    fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants