Unverified Commit 0cf3c5d9 authored by Luc Didry's avatar Luc Didry
Browse files

Fix #595 according to @ikedas review

parent 07441b18
...@@ -139,9 +139,9 @@ installconfig: installdir ...@@ -139,9 +139,9 @@ installconfig: installdir
fi fi
@echo "Installing configuration template ..." \ @echo "Installing configuration template ..." \
echo "installing sympa.conf-dist"; \ echo "installing sympa.conf-dist"; \
$(INSTALL) -m 644 -T sympa.conf-dist $(DESTDIR)$(sysconfdir)/sympa.conf-dist; \ $(INSTALL) -m 644 -T sympa.conf-dist $(DESTDIR)$(confdir)/sympa.conf-dist; \
chown $(USER) $(DESTDIR)$(sysconfdir)/sympa.conf-dist; \ chown $(USER) $(DESTDIR)$(confdir)/sympa.conf-dist; \
chgrp $(GROUP) $(DESTDIR)$(sysconfdir)/sympa.conf-dist; chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf-dist;
-@if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \ -@if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
cd $(DESTDIR)$(sysconfdir); \ cd $(DESTDIR)$(sysconfdir); \
echo "# automatically created file" >> data_structure.version; \ echo "# automatically created file" >> data_structure.version; \
...@@ -185,7 +185,7 @@ nextstep: ...@@ -185,7 +185,7 @@ nextstep:
@echo "#" @echo "#"
@echo "# ADDITIONAL SETTINGS:" @echo "# ADDITIONAL SETTINGS:"
@echo "# * You will find all available configuration settings in:" @echo "# * You will find all available configuration settings in:"
@echo "# $(sysconfdir)/sympa.conf-dist" @echo "# $(confdir)/sympa.conf-dist"
@echo "#" @echo "#"
@echo "# * Copy the configuration settings you want in:" @echo "# * Copy the configuration settings you want in:"
@echo "# $(confdir)/sympa.conf" @echo "# $(confdir)/sympa.conf"
...@@ -215,13 +215,6 @@ tidyall: ...@@ -215,13 +215,6 @@ tidyall:
all-local: sympa.conf-dist all-local: sympa.conf-dist
sympa.conf-dist: mk-sympa-dist.pl sympa.conf-dist:
@./mk-sympa-dist.pl @$(PERL) mk-sympa-dist.pl
mk-sympa-dist.pl:
@rm -f $@
$(AM_V_GEN)$(SED) \
-e 's|--PERL--|$(PERL)|' \
-e 's|--srcdir--|$(srcdir)|' \
< $(srcdir)/$@.in > $@
@chmod +x $@
...@@ -610,6 +610,7 @@ AC_SUBST(POSTMAP_ARG) ...@@ -610,6 +610,7 @@ AC_SUBST(POSTMAP_ARG)
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
sympa.conf sympa.conf
mk-sympa-dist.pl
default/Makefile default/Makefile
doc/Makefile doc/Makefile
po/Makefile po/Makefile
......
#!--PERL--
# -*- indent-tabs-mode: nil; -*- # -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4 # vim:ft=perl:et:sw=4
# $Id$ # $Id$
# Sympa - SYsteme de Multi-Postage Automatique # Sympa - SYsteme de Multi-Postage Automatique
# #
# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel # Copyright 2019 The Sympa Community. See the AUTHORS.md file at the
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2018 The Sympa Community. See the AUTHORS.md file at the
# top-level directory of this distribution and at # top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>. # <https://github.com/sympa-community/sympa.git>.
# #
...@@ -26,7 +21,7 @@ ...@@ -26,7 +21,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib '--srcdir--/src/lib/'; use lib 'src/lib/';
use strict; use strict;
use warnings; use warnings;
use English qw(-no_match_vars); use English qw(-no_match_vars);
...@@ -78,7 +73,8 @@ if ($modfail) { ...@@ -78,7 +73,8 @@ if ($modfail) {
my $dist_conf = 'sympa.conf-dist'; my $dist_conf = 'sympa.conf-dist';
my $umask = umask 037; my $umask = umask 037;
unless (open NEWF, '>', $dist_conf) { my $fh;
unless (open $fh, '>', $dist_conf) {
umask $umask; umask $umask;
die "$0: " die "$0: "
. sprintf(gettext("Unable to open %s : %s"), $dist_conf, $ERRNO) . sprintf(gettext("Unable to open %s : %s"), $dist_conf, $ERRNO)
...@@ -97,38 +93,38 @@ foreach my $param (@Sympa::ConfDef::params) { ...@@ -97,38 +93,38 @@ foreach my $param (@Sympa::ConfDef::params) {
next unless $param->{'file'}; next unless $param->{'file'};
if ($title) { if ($title) {
printf NEWF "###\\\\\\\\ %s ////###\n\n", $title; printf $fh "###\\\\\\\\ %s ////###\n\n", $title;
undef $title; undef $title;
} }
printf NEWF "## %s\n", $param->{'name'}; printf $fh "## %s\n", $param->{'name'};
if ($param->{'gettext_id'}) { if ($param->{'gettext_id'}) {
print NEWF Sympa::Tools::Text::wrap_text( print $fh Sympa::Tools::Text::wrap_text(
gettext($param->{'gettext_id'}), gettext($param->{'gettext_id'}),
'## ', '## '); '## ', '## ');
} }
print NEWF Sympa::Tools::Text::wrap_text( print $fh Sympa::Tools::Text::wrap_text(
gettext($param->{'gettext_comment'}), gettext($param->{'gettext_comment'}),
'## ', '## ') '## ', '## ')
if $param->{'gettext_comment'}; if $param->{'gettext_comment'};
if (defined $param->{'sample'}) { if (defined $param->{'sample'}) {
printf NEWF '## ' . gettext('Example: ') . "%s\t%s\n", printf $fh '## ' . gettext('Example: ') . "%s\t%s\n",
$param->{'name'}, $param->{'sample'}; $param->{'name'}, $param->{'sample'};
} }
if (defined $param->{'default'}) { if (defined $param->{'default'}) {
printf NEWF "#%s\t%s\n", $param->{'name'}, $param->{'default'}; printf $fh "#%s\t%s\n", $param->{'name'}, $param->{'default'};
} elsif ($param->{'optional'}) { } elsif ($param->{'optional'}) {
printf NEWF "#%s\t\n", $param->{'name'}; printf $fh "#%s\t\n", $param->{'name'};
} else { } else {
printf NEWF "#%s\t%s\n", $param->{'name'}, printf $fh "#%s\t%s\n", $param->{'name'},
gettext("(You must define this parameter)"); gettext("(You must define this parameter)");
} }
print NEWF "\n"; print $fh "\n";
} }
close NEWF; close $fh;
print STDERR "$dist_conf file has been created\n"; 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