diff options
Diffstat (limited to 'debian/echolot.postinst.in')
-rwxr-xr-x | debian/echolot.postinst.in | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/debian/echolot.postinst.in b/debian/echolot.postinst.in deleted file mode 100755 index 1f68dc8..0000000 --- a/debian/echolot.postinst.in +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh -e - -# postinst for Echolot - -. /usr/share/debconf/confmodule - -# Make sure the echolot user exists -adduser --quiet \ - --quiet \ - --system \ - --disabled-password \ - --shell /bin/bash \ - --home /var/lib/echolot \ - --no-create-home \ - --group \ - --gecos "Echolot Pinger" \ - echolot - -# Give the echolot user write permissions to /var/log/echolot/echolot.log -touch /var/log/echolot/echolot.log -chown echolot.adm /var/log/echolot/echolot.log -chmod 640 /var/log/echolot/echolot.log -# and /var/lib/echolot -if ( ! dpkg-statoverride --list /var/lib/echolot > /dev/null ); then - dpkg-statoverride --update --add root echolot 02775 /var/lib/echolot -fi -# and /var/run/echolot -if ( ! dpkg-statoverride --list /var/run/echolot > /dev/null ); then - dpkg-statoverride --update --add root echolot 02770 /var/run/echolot -fi - - -######################################################################## -# User configuration -######################################################################## -if [ "$1" = "configure" ]; then - - ######################## - # Echolot configuration - - filename=`tempfile`; -cat > $filename << 'EOF' -#!/usr/bin/perl -w - - use strict; - use Debconf::Client::ConfModule; - use IO::File; - - my $postblock = ""; - my $preblock = ""; - - if ( -e "/etc/echolot/pingd.conf" ) { - my $fh = new IO::File; - $fh->open("/etc/echolot/pingd.conf") or - die ("Cannot open /etc/echolot/pingd.conf: $!"); - while (<$fh>) { - last if (/^### BEGIN DEBCONF SECTION/); - $preblock .= $_; - }; - while (<$fh>) { - last if (/^### END DEBCONF SECTION/); - }; - while (<$fh>) { - $postblock .= $_; - }; - $fh->close() or - die ("Cannot close /etc/echolot/pingd.conf: $!"); - }; - - my $address = Debconf::Client::ConfModule::get("echolot/address"); - my $operator = Debconf::Client::ConfModule::get("echolot/operator"); - my $sitename = Debconf::Client::ConfModule::get("echolot/sitename"); - my $recipient_delimiter = Debconf::Client::ConfModule::get("echolot/recipient_delimiter"); - - my ($local, $domain) = split (/@/, $address, 2); - - my $debconf = sprintf("\$CONFIG->{q{my_localpart} } = q{%s};\n", $local); - $debconf .= sprintf("\$CONFIG->{q{my_domain} } = q{%s};\n", $domain); - $debconf .= sprintf("\$CONFIG->{q{operator_address} } = q{%s};\n", $operator); - $debconf .= sprintf("\$CONFIG->{q{sitename} } = q{%s};\n", $sitename); - $debconf .= sprintf("\$CONFIG->{q{recipient_delimiter} } = q{%s};\n", $recipient_delimiter); - - my $fh = new IO::File; - $fh->open(">/etc/echolot/pingd.conf") or - die ("Cannot open /etc/echolot/pingd.conf: $!"); - print $fh $preblock . - "### BEGIN DEBCONF SECTION\n" . - $debconf . - "1;\n" . - "### END DEBCONF SECTION\n" . - $postblock or - die ("Cannot write to /etc/echolot/pingd.conf: $!"); - $fh->close or - die ("Cannot close /etc/echolot/pingd.conf: $!"); -EOF - chmod +x $filename; - $filename - rm $filename -fi - -#DEBHELPER# - -######################################################################## -# Configuration reprise -######################################################################## -if [ "$1" = "configure" ]; then - db_get echolot/addnow || true - if [ "$RET" = "true" ]; then - /etc/init.d/echolot add REMAILER_LIST - # But don't do it again unless the user asks for it - db_set echolot/addnow false - fi -fi - - -db_stop - -# vim:set ts=4: -# vim:set shiftwidth=4: |