From: Tollef Fog Heen Date: Fri, 2 May 2008 14:07:20 +0000 (+0200) Subject: First shot at implementing dbconfig-common support X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=378dc8e9fad4e34f9f2d61ae851e93fb91c00964;p=scalable-opengroupware.org First shot at implementing dbconfig-common support --- diff --git a/debian/control b/debian/control index e61c4bab..8ed852c8 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,8 @@ Standards-Version: 3.7.2 Package: scalable-opengroupware.org Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, dbconfig-common +Recommends: slapd, postgresql-8.1 Description: diff --git a/debian/gnustepdefaults.template b/debian/gnustepdefaults.template new file mode 100644 index 00000000..2d1687d8 --- /dev/null +++ b/debian/gnustepdefaults.template @@ -0,0 +1,30 @@ +{ + NSGlobalDomain = { + LDAPDebugEnabled = YES; + }; + sogod-0.9 = { + OCSFolderInfoURL = "postgresql://_DBC_DBUSER_:_DBC_DBPASS_@_DBC_DBSERVER_:_DBC_DBPORT_/_DBC_DBNAME_/sogo_folder_info"; + AgenorProfileURL = "postgresql://_DBC_DBUSER_:_DBC_DBPASS_@_DBC_DBSERVER_:_DBC_DBPORT_/_DBC_DBNAME_/sogo_user_profile"; + WOMessageUseUTF8 = YES; + WOParsersUseUTF8 = YES; + WOPort = 20000; + SOGoDefaultMailDomain = "sogo.linpro.no"; + SOGoFallbackIMAP4Server = "localhost"; + SOGoAuthentificationMethod = "LDAP"; + SOGoLDAPSources = + ( + { + CNFieldName = "displayName"; + IDFieldName = "uid"; + UIDFieldName = "uid"; + baseDN = "dc=sogo,dc=linpro,dc=no"; + bindDN = "cn=admin,dc=sogo,dc=linpro,dc=no"; + bindPassword = "abcd"; + hostname = "localhost"; + port = 389; + canAuthenticate = YES; + id = "userdb"; + } + ); + }; +} diff --git a/debian/rules b/debian/rules index 2ec84728..3beb5fdd 100755 --- a/debian/rules +++ b/debian/rules @@ -91,6 +91,7 @@ binary-arch: build install dh_installexamples dh_install --list-missing --sourcedir=debian/tmp dh_installdirs + cp debian/gnustepdefaults.template debian/scalable-opengroupware.org/var/lib/scalable-opengroupware.org/ # dh_installmenu # dh_installdebconf # dh_installlogrotate diff --git a/debian/scalable-opengroupware.org.config b/debian/scalable-opengroupware.org.config new file mode 100644 index 00000000..6795f9b5 --- /dev/null +++ b/debian/scalable-opengroupware.org.config @@ -0,0 +1,12 @@ +#! /bin/sh + +# source debconf stuff +. /usr/share/debconf/confmodule +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then + . /usr/share/dbconfig-common/dpkg/config.pgsql + dbc_dbuser=sogo + dbc_dbname=sogo + + dbc_go scalable-opengroupware.org "$@" +fi diff --git a/debian/scalable-opengroupware.org.dirs b/debian/scalable-opengroupware.org.dirs index 36dca78c..e2b7e007 100644 --- a/debian/scalable-opengroupware.org.dirs +++ b/debian/scalable-opengroupware.org.dirs @@ -1,3 +1,5 @@ /var/run/sogo /var/spool/sogo /var/log/sogo +/etc/scalable-opengroupware.org +/var/lib/scalable-opengroupware.org diff --git a/debian/scalable-opengroupware.org.postinst b/debian/scalable-opengroupware.org.postinst index 2215e8f9..9e1b9a8d 100644 --- a/debian/scalable-opengroupware.org.postinst +++ b/debian/scalable-opengroupware.org.postinst @@ -1,10 +1,27 @@ #! /bin/sh -e +. /usr/share/debconf/confmodule + if [ -z "$2" ]; then - adduser --system sogo + SOGOHOME=/var/lib/scalable-opengroupware.org + adduser --system sogo --home $SOGOHOME --shell /bin/bash + + install -d -o sogo /var/spool/sogo + install -d -o sogo /var/log/sogo + install -d -o sogo $SOGOHOME/GNUstep/Defaults + + dbc_generate_include=template:/etc/scalable-opengroupware.org/config + dbc_generate_include_owner=sogo + dbc_generate_include_perms=0600 + dbc_pgsql_createdb_encoding=UTF8 + dbc_authmethod_user=password + dbc_generate_include_args="-f template" - install -d -o sogo /var/spool/sogo - install -d -o sogo /var/log/sogo + if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then + . /usr/share/dbconfig-common/dpkg/postinst.pgsql + dbc_go scalable-opengroupware.org "$@" + fi + ln -s /etc/scalable-opengroupware.org/config $SOGOHOME/GNUstep/Defaults/.GNUstepDefaults fi #DEBHELPER# diff --git a/debian/scalable-opengroupware.org.postrm b/debian/scalable-opengroupware.org.postrm new file mode 100644 index 00000000..d0ddaa28 --- /dev/null +++ b/debian/scalable-opengroupware.org.postrm @@ -0,0 +1,14 @@ +#! /bin/sh + +if [ "$1" = "purge" ]; then + if which deluser > /dev/null 2>&1; then + deluser --remove-home sogo + fi + + rm -f /etc/scalable-opengroupware.org/config $SOGOHOME/GNUstep/Defaults/.GNUstepDefaults + if which ucf >/dev/null 2>&1; then + ucf --purge /etc/scalable-opengroupware.org/config + fi +fi + +#DEBHELPER#