#!/bin/sh set -e avahi_install() { if [ -d /etc/avahi/services/ -a ! -e /etc/avahi/services/tt-rss.service -a ! -L /etc/avahi/services/tt-rss.service ] ; then ln -s ../../tt-rss/avahi.service /etc/avahi/services/tt-rss.service fi } lighttpd_install() { if which lighty-enable-mod >/dev/null 2>&1 ; then lighty-enable-mod tt-rss fastcgi fastcgi-php || true avahi_install fi } apache2_install() { if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then apache2_invoke enconf 50-tt-rss avahi_install elif dpkg-query -f '${Version}' -W 'apache2.2-common' > /dev/null 2>&1 ; then if [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/50-tt-rss.conf ] ; then ln -s ../conf-available/50-tt-rss.conf /etc/apache2/conf.d/50-tt-rss.conf fi fi } ttrss_config_set() { KEY="$1" VAL=`echo "$2" | sed 's~/~\\\/~g'` perl -p -i -e "s/define\('$KEY', '(.*)'\);/define('$KEY', '$VAL');/g" /etc/tt-rss/config.php } if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then . /usr/share/apache2/apache2-maintscript-helper fi if [ "$1" = "configure" ]; then setperm() { FILE="$1" dpkg-statoverride --list "$FILE" >/dev/null || \ dpkg-statoverride --update --add www-data www-data 755 "$FILE" } # tt-rss will write files into these directories setperm /var/lib/tt-rss/feed-icons setperm /var/lib/tt-rss setperm /var/cache/tt-rss/js setperm /var/cache/tt-rss/images setperm /var/cache/tt-rss/export setperm /var/cache/tt-rss/upload setperm /var/cache/tt-rss # deprecated directory of previous tt-rss versions if [ -d /var/cache/tt-rss/magpie ]; then rm -rf /var/cache/tt-rss/magpie fi # phpqrcode was previously embedded into tt-rss. # dpkg does not replace directories with symlinks. phpqrcodedir="/usr/share/tt-rss/www/lib/phpqrcode" phpqrcodelink="../../../phpqrcode" if [ -d $phpqrcodedir ] && [ ! -L $phpqrcodedir ]; then if rmdir $phpqrcodedir 2>/dev/null; then ln -sf $phpqrcodelink $phpqrcodedir fi fi # source debconf stuff if [ -f /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule fi # dbconfig-common if [ -f /usr/share/dbconfig-common/dpkg/postinst ]; then . /usr/share/dbconfig-common/dpkg/postinst dbc_generate_include="php:/etc/tt-rss/database.php" dbc_generate_include_owner="root:www-data" dbc_generate_include_perms="0640" dbc_pgsql_createdb_encoding="UTF8" dbc_go tt-rss $@ fi # webserver configuration db_get tt-rss/reconfigure-webserver webservers="$RET" for webserver in $webservers; do webserver=${webserver%,} if [ "$webserver" = "lighttpd" ]; then lighttpd_install elif [ "$webserver" = "apache2" ]; then apache2_install fi # Reload webserver in any case, configuration might have changed # Redirection of 3 is needed because Debconf uses it and it might # be inherited by webserver. See bug #446324. if [ -x /usr/sbin/invoke-rc.d ]; then invoke-rc.d $webserver reload 3>/dev/null || true else /etc/init.d/$webserver reload 3>/dev/null || true fi done # set tt-rss according to config db_get tt-rss/self_url_path ttrss_config_set "SELF_URL_PATH" "$RET" fi # Automatically added by dh_installinit/13.23 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/tt-rss" ]; then update-rc.d tt-rss defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native tt-rss $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.23 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'tt-rss.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'tt-rss.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'tt-rss.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'tt-rss.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.23 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'tt-rss.service' >/dev/null || true fi fi # End automatically added section exit 0