From f00c5e3f4b501899fc0c609aea36d47230420d3a Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Mon, 24 Jun 2019 17:23:07 +0200 Subject: [PATCH 1/1] initial release --- README.CARNet | 8 ++ debian/changelog | 5 ++ debian/compat | 1 + debian/control | 21 ++++++ debian/copyright | 7 ++ debian/docs | 1 + debian/postinst | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++ debian/postrm | 37 ++++++++++ debian/prerm | 34 +++++++++ debian/rules | 3 + debian/source/format | 1 + 11 files changed, 319 insertions(+) create mode 100644 README.CARNet create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100755 debian/postinst create mode 100755 debian/postrm create mode 100755 debian/prerm create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/README.CARNet b/README.CARNet new file mode 100644 index 0000000..7c8e7ff --- /dev/null +++ b/README.CARNet @@ -0,0 +1,8 @@ +roundcube-cn +~~~~~~~~~~~~ + +Ovaj paket podesava tipicne vrijednosti u datoteci config.inc.php. + +Trenutno odrzava Ivan Rako . + + -- Ivan Rako Wed, 19 Jun 2019 13:01:21 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ec4a2cc --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +roundcube-cn (1.2.3+1) stable; urgency=low + + * Prva inacica paketa + + -- Ivan Rako Wed, 19 Jun 2019 13:02:10 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..1afdbbe --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: roundcube-cn +Priority: optional +Section: web +Maintainer: Ivan Rako +Build-Depends: debhelper (>> 9) +Standards-Version: 3.9.8 +Homepage: https://roundcube.net/ + +Package: roundcube-cn +Architecture: all +Pre-Depends: apache2-cn (>= 2.4.10+1), php-cn | php5-cn | php7.0-cn +Depends: roundcube (>= 1.2.3+dfsg.1-4+deb9u3), carnet-tools-cn (>= 3.1.0), hostname (>= 3.15), ${misc:Depends} +Conflicts: squirrelmail-cn, squirrelmail +Recommends: dovecot-cn | imap-server +Description: skinnable AJAX based webmail solution for IMAP servers + RoundCube Webmail is a browser-based multilingual IMAP client with an + application-like user interface. It provides full functionality + expected from an e-mail client, including MIME support, address book, + folder manipulation and message filters. + . + This package contains additional CARNet configuration. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..3683110 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,7 @@ +Copyright 2019 CARNet + +You are free to distribute this software package under the terms of the +GNU General Public License. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file /usr/share/common-licenses/GPL. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..8f6e250 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.CARNet diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..8f7867f --- /dev/null +++ b/debian/postinst @@ -0,0 +1,201 @@ +#!/bin/sh + +set -e + +[ "$DEBIAN_SCRIPT_DEBUG" ] && set -x + +# Source debconf library. +. /usr/share/debconf/confmodule + +case "$1" in + configure) + # continue below + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + + +PKG=roundcube-cn +domainname=`dnsdomainname` +FQDN=`hostname --fqdn` + +# Include CARNet functions +. /usr/share/carnet-tools/functions.sh +unset CP_ECHO_RETURN + + +if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then + . /usr/share/apache2/apache2-maintscript-helper + + roundcube_enable() { + cp_echo "CN: Enabling $PKG configuration for Apache2." + return 0 + } +else + cp_echo "CN: Could not load Apache 2.4 maintainer script helper." + + roundcube_enable() { + return 1 + } +fi + +mv_old_backups () { + # Clean up /etc, nove old jun^H^H^Hbackups where they belong + local glob="$1.old.*-*-*.*:*:*" + + # ${glob%/*} (dirname $glob) does not work for files in root + if [ -n "$(find ${glob%/*} -name ${glob##*/})" ]; then + for i in $(find ${glob%/*} -name ${glob##*/}) + do + cp_backup_conffile "$i" "$2" + rm -f "$i" + done + fi +} + +# listconffiles () +# +# Recursively walks /etc/apache2/apache2.conf for Include and +# IncludeOptional directives. +# Returns all configfiles so defined. +# +listconffiles () { + local i incs + local base_dir="`dirname $1`" + + incs=`awk 'tolower($1) ~ /include(optional)?/ { sub("/$","/*",$2); print $2; }' $1` + incs=`echo "$incs" | sed -r "s#^([^/])#${base_dir}/\1#"` + if [ -n "$incs" ]; then + for i in $incs; do + if [ -e "$i" ]; then echo "`readlink -m -q $i`"; listconffiles "$i"; fi + done + fi +} + +# genlocales () +# +# Update/generate localisation files from templates if locales-all +# is not installed. +# +genlocales () { + if [ -f /usr/lib/locales-all/supported.tar.lzma ] ; then + cp_echo "CN: locales-all installed, skipping locales generation." + else + locale-gen + fi +} + + +DATE=`date +%Y-%m-%d.%H:%M:%S` +CONFDIR=/etc/roundcube +CONF=$CONFDIR/apache.conf + +backup_name=roundcube_apache.conf +mv_old_backups $CONF $backup_name + +# Check Apache2 web server configuration. +# +if [ -f "$CONF" ]; then + + # Backup first. + if cp_check_and_backup "$CONF" "$backup_name"; then + cp_echo "CN: Old $CONF saved as \"/var/backups/$backup_name.bak\"." + fi + + # Check if we already modified apache.conf + if ! egrep -q "^[ ]+RewriteRule \. https" "$CONF"; then + echo -n "CN: Updating Apache2 configuration for Roundcube" + perl -n -e 'print if ! m|^Alias\s*/webmail|' "$CONF" > $CONF.tmp + + cp-update -t $PKG $CONF.tmp <<-EOF +# Force SSL for /webmail -> you can still use /roundcube +Alias /webmail /var/lib/roundcube + + + + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L] + + + + +# +# WARNING: This file is automatically included in each VirtualHost +# entry you might have. Do not enable the VirtualHost example provided +# in this file, it WILL break your Apache configuration. Copy the +# VirtualHost section to the standard webserver configuration file +# instead. +# +EOF + cp_mv $CONF.tmp $CONF + + # This will break if cp_backup_conffile ever changes destination path + if ! cmp -s "$CONF" "/var/backups/$backup_name.bak"; then + echo "." + cp_echo "CN: Updated Apache2 configuration for Roundcube." + else + echo "... no changes." + fi + fi +fi + + +hconf=/etc/apache2/apache2.conf +sconf=/etc/apache2/sites-available/ssl + +# Initial CARNet config tweaks. +# +CONF="$CONFDIR/config.inc.php" +mv_old_backups "$CONF" "`basename $CONF`" +if cp_check_and_backup "$CONF"; then + cp_echo "CN: Old $CONF saved as \"/var/backups/${CONF##*/}.bak\"." +fi + +# We use sed to replace old defaults with ours. +# Must escape \$ because of shell expansion. +# +seddef="/default_host/s/''/'localhost'/g; + /smtp_server/s/''/'localhost'/g; + " + +cp_check_and_sed '.' "$seddef" "$CONF" || true + +# Mailname info... +# +if [ "$nodots" -o "$nomailname" ]; then + cp_echo + cp_echo "CN: Make sure that /etc/mailname contains a fully qualified domain name" + cp_echo "CN of this machine! Sending mail via Roundcube might fail if the FQDN" + cp_echo "CN cannot be found in either /etc/mailname or /etc/hostname." + cp_echo "CN Read mailname(5) man page for details." + cp_echo -mailonly "CN If this machine receives mail for both user@`hostname -f` and " + cp_echo -mailonly "CN user@`hostname -d`, you can also put just the domain in there." + cp_echo +fi + +if roundcube_enable; then + apache2_invoke enconf roundcube +fi + +if ! apache2ctl configtest >/dev/null 2>&1; then + cp_echo "CN: Your Apache2 configuration seems to be broken." + cp_echo "CN: Please, check the service after the installation finishes!" +fi + +# Mail root +# +cp_mail "$PKG" + + + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..0b96542 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +# Debconf +. /usr/share/debconf/confmodule + +PKG=roundcube-cn + +if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then + . /usr/share/apache2/apache2-maintscript-helper + + roundcube_enable() { + echo "CN: Purging $PKG configuration for Apache2." + return 0 + } +else + echo "CN: Could not load Apache 2.4 maintainer script helper." + + roundcube_enable() { + return 1 + } +fi + +if [ "$1" = "purge" ] ; then + if roundcube_enable; then + apache2_invoke disconf $PKG + fi + + if [ "`readlink -q -m /etc/apache2/conf-available/$PKG.conf`" = /etc/roundcube/apache.conf ]; then + rm -f /etc/apache2/conf-available/$PKG.conf + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/prerm b/debian/prerm new file mode 100755 index 0000000..788f9b6 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +PKG=roundcube-cn + +if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then + . /usr/share/apache2/apache2-maintscript-helper + + roundcube_enable() { + echo "CN: Disabling $PKG configuration for Apache2." + return 0 + } +else + echo "CN: Could not load Apache 2.4 maintainer script helper." + + roundcube_enable() { + return 1 + } +fi + +if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then + if [ -f /etc/roundcube/apache.conf ]; then + cp-update -r $PKG /etc/roundcube/apache.conf + fi + + if roundcube_enable; then + apache2_invoke disconf $PKG + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..cbe925d --- /dev/null +++ b/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) -- 1.7.10.4