#!/bin/sh set -e . /usr/share/debconf/confmodule . /usr/share/dbconfig-common/dpkg/postinst.pgsql dbc_go miniflux "$@" create_config() { newcfg="$(mktemp)" case "$dbc_dbtype" in pgsql) echo "DATABASE_URL=postgresql://$dbc_dbuser:$dbc_dbpass@$dbc_dbserver/$dbc_dbname" > $newcfg ;; "") ;; esac MINIFLUX_USER="miniflux" MINIFLUX_GROUP="$MINIFLUX_USER" MINIFLUX_NAME="minimalist and opinionated feed reader" if ! getent group | grep -q "^$MINIFLUX_GROUP:" ; then addgroup --quiet --system "$MINIFLUX_GROUP" 2>/dev/null || true fi if ! getent passwd | grep -q "^$MINIFLUX_USER:" ; then adduser --quiet --system --ingroup "$MINIFLUX_GROUP" \ --no-create-home --home /nonexistent \ --disabled-password "$MINIFLUX_USER" 2>/dev/null || true fi usermod -c "$MINIFLUX_NAME" -g "$MINIFLUX_GROUP" "$MINIFLUX_USER" mkdir -p /etc/miniflux ucf --three-way --debconf-ok "$newcfg" /etc/miniflux/miniflux.conf ucfr miniflux /etc/miniflux/miniflux.conf if ! dpkg-statoverride --list /etc/miniflux >/dev/null; then chown "$MINIFLUX_USER:$MINIFLUX_GROUP" /etc/miniflux chown "$MINIFLUX_USER:$MINIFLUX_GROUP" /etc/miniflux/miniflux.conf chmod 644 /etc/miniflux/miniflux.conf fi rm -f $newcfg miniflux -c "/etc/miniflux/miniflux.conf" -migrate || true } if [ "$1" = "configure" ]; then create_config fi #DEBHELPER#