Unverified Commit 0ca42000 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #595 from ldidry/add-sympa-conf-dist by ldidry

Add sympa.conf-dist
parents cbc02daa ec80e1b3
......@@ -18,6 +18,7 @@ Makefile
/po/sympa/POTFILES
/po/web_help/POTFILES
/sympa.conf
/sympa.conf-dist
# make
......@@ -30,6 +31,7 @@ Makefile
*.o
*.po~
/previous_sympa_version
/mk-sympa-dist.pl
/src/bin/*.pl
/src/cgi/*.fcgi
/src/libexec/*.pl
......
......@@ -137,6 +137,11 @@ installconfig: installdir
chown $(USER) $(DESTDIR)$(confdir)/sympa.conf; \
chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf; \
fi
@echo "Installing configuration template ..." \
echo "installing sympa.conf-dist"; \
$(INSTALL) -m 644 -T sympa.conf-dist $(DESTDIR)$(confdir)/sympa.conf-dist; \
chown $(USER) $(DESTDIR)$(confdir)/sympa.conf-dist; \
chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf-dist;
-@if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
cd $(DESTDIR)$(sysconfdir); \
echo "# automatically created file" >> data_structure.version; \
......@@ -178,6 +183,13 @@ nextstep:
@echo "# * Edit this file to define initial configuration:"
@echo "# $(confdir)/sympa.conf"
@echo "#"
@echo "# ADDITIONAL SETTINGS:"
@echo "# * You will find all available configuration settings in:"
@echo "# $(confdir)/sympa.conf-dist"
@echo "#"
@echo "# * Copy the configuration settings you want in:"
@echo "# $(confdir)/sympa.conf"
@echo "#"
@echo "# UPGRADING"
@echo "# * Run this script to upgrade your data structures:"
@echo "# $(sbindir)/sympa.pl --upgrade"
......@@ -200,3 +212,9 @@ distcheck-hook:
tidyall:
tidyall --conf-file doc/dot.tidyallrc --root-dir . -r src t xt
all-local: sympa.conf-dist
sympa.conf-dist:
@$(PERL) mk-sympa-dist.pl
......@@ -610,6 +610,7 @@ AC_SUBST(POSTMAP_ARG)
AC_CONFIG_FILES([
Makefile
sympa.conf
mk-sympa-dist.pl
default/Makefile
doc/Makefile
po/Makefile
......
# -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4
# $Id$
# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright 2019 The Sympa Community. See the AUTHORS.md file at the
# top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib 'src/lib/';
use strict;
use warnings;
use English qw(-no_match_vars);
use Pod::Usage;
use Sympa::ConfDef;
use Sympa::Constants;
my $modfail; # any of required modules are not installed.
BEGIN {
$modfail = !eval {
require Conf;
require Sympa::Tools::Text;
};
}
# Set language context if possible.
*gettext = sub { $_[1] ? sprintf('%*s', $_[1], $_[0]) : $_[0] };
if ($modfail) {
no warnings;
eval { require Text::Wrap; };
if ($EVAL_ERROR) {
*Sympa::Tools::Text::wrap_text = sub {"$_[1]$_[0]\n"};
} else {
$Text::Wrap::columns = 78;
*Sympa::Tools::Text::wrap_text =
sub { Text::Wrap::wrap($_[1], $_[2], $_[0]) . "\n"; };
}
}
## sympa dist configuration file
my $dist_conf = 'sympa.conf-dist';
my $umask = umask 037;
my $fh;
unless (open $fh, '>', $dist_conf) {
umask $umask;
die "$0: "
. sprintf(gettext("Unable to open %s : %s"), $dist_conf, $ERRNO)
. "\n";
}
umask $umask;
my $title;
foreach my $param (@Sympa::ConfDef::params) {
unless ($param->{'name'}) {
$title = gettext($param->{'gettext_id'})
if $param->{'gettext_id'};
next;
}
next unless $param->{'file'};
if ($title) {
printf $fh "###\\\\\\\\ %s ////###\n\n", $title;
undef $title;
}
printf $fh "## %s\n", $param->{'name'};
if ($param->{'gettext_id'}) {
print $fh Sympa::Tools::Text::wrap_text(
gettext($param->{'gettext_id'}),
'## ', '## ');
}
print $fh Sympa::Tools::Text::wrap_text(
gettext($param->{'gettext_comment'}),
'## ', '## ')
if $param->{'gettext_comment'};
if (defined $param->{'sample'}) {
printf $fh '## ' . gettext('Example: ') . "%s\t%s\n",
$param->{'name'}, $param->{'sample'};
}
if (defined $param->{'default'}) {
printf $fh "#%s\t%s\n", $param->{'name'}, $param->{'default'};
} elsif ($param->{'optional'}) {
printf $fh "#%s\t\n", $param->{'name'};
} else {
printf $fh "#%s\t%s\n", $param->{'name'},
gettext("(You must define this parameter)");
}
print $fh "\n";
}
close $fh;
print STDERR "$dist_conf file has been created\n";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment