Changeset 2136 in ProjectBuilder


Ignore:
Timestamp:
Aug 28, 2016, 8:03:38 PM (5 years ago)
Author:
Bruno Cornec
Message:

Fix #115

The standard conf file is now under /usr/share/pb and the one under
/etc/pn is modifyable by the sysadmin is contains only comments by
default.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/Makefile.PL

    r2032 r2136  
    2222    EXE_FILES     => [ qw(bin/pbdistrocheck bin/pbgetparam) ],
    2323    MAN1PODS      => {
    24                         'bin/pbdistrocheck' => '$(INST_MAN1DIR)/pbdistrocheck.$(MAN1EXT)',
    25                         'bin/pbgetparam' => '$(INST_MAN1DIR)/pbgetparam.$(MAN1EXT)',
     24                'bin/pbdistrocheck' => '$(INST_MAN1DIR)/pbdistrocheck.$(MAN1EXT)',
     25                'bin/pbgetparam' => '$(INST_MAN1DIR)/pbgetparam.$(MAN1EXT)',
    2626                    },
    2727#   MAN3PODS      => {  'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)',
     
    3737sub postamble {
    3838
    39     # Determine location of etc conf files
     39    # Determine location of conf files
    4040    my $text ="";
    4141
    42     # Grab out any CONFDIR or MANDIR param
    43     my $etcdir = undef;
     42    # Grab out any SYSCONFDIR, CONFDIR or MANDIR param
     43    my $sharedir = undef;
    4444    my $mandir = undef;
     45    my $sysconfdir = undef;
    4546    my $prefix = undef;
    4647
     
    4849        my ($key, $value) = split /=/, $arg;
    4950        if ($key =~ /^CONFDIR$/) {
    50             $etcdir = $value;
     51            $sharedir = $value;
     52        } elsif ($key =~ /^SYSCONFDIR$/) {
     53            $sysconfdir = $value;
    5154        } elsif ($key =~ /^MANDIR$/) {
    5255            $mandir = $value;
     
    5659    }
    5760
    58     $etcdir ||= "$prefix/etc/pb" if (defined $prefix);
     61    $sharedir ||= "$prefix/share/pb" if (defined $prefix);
    5962    $mandir ||= "$prefix/share/man" if (defined $prefix);
    60     $etcdir ||= "/usr/local/etc/pb";
     63    $sysconfdir ||= "$prefix/etc/pb" if (defined $prefix);
     64    $sharedir ||= "/usr/local/share/pb";
    6165    $mandir ||= "/usr/local/share/man";
     66    $sysconfdir ||= "/etc/pb";
    6267
    6368    # Use that conf dir info to modify Distribution.pm
    64     system("perl -pi -e \"s~CCCC~$etcdir~\" lib/ProjectBuilder/Distribution.pm");
     69    system("perl -pi -e \"s~CCCC~$sharedir~\" lib/ProjectBuilder/Distribution.pm");
     70    system("perl -pi -e \"s~SSSS~$sysconfdir~\" lib/ProjectBuilder/Distribution.pm");
    6571
    6672    $text .= "install ::\n";
    67     $text .= "\t".'mkdir -p $(DESTDIR)'."$etcdir\n";
    68     $text .= "\t".'chmod 755 $(DESTDIR)'."$etcdir\n";
    69     $text .= "\t".'cp etc/pb.conf $(DESTDIR)'."$etcdir\n";
     73    $text .= "\t".'mkdir -p $(DESTDIR)'."$sharedir\n";
     74    $text .= "\t".'chmod 755 $(DESTDIR)'."$sharedir\n";
     75    $text .= "\t".'cp etc/pb.conf $(DESTDIR)'."$sharedir\n";
     76
     77    # Also create a fake version in /etc/pb for sysadmin to modify
     78    $text .= "\t".'mkdir -p $(DESTDIR)'."$sysconfdir\n";
     79    $text .= "\t".'chmod 755 $(DESTDIR)'."$sysconfdir\n";
     80    $text .= "\t".'perl -p -e \'s|^|#|\' etc/pb.conf > $(DESTDIR)/'."$sysconfdir/pb.conf\n";
     81    # Doesn't seem to work in the makefile generated for now :-(
     82    #$text .= "\t".'perl -p -e \'s|^([^#])|#$1|\' etc/pb.conf > $(DESTDIR)/'."$sysconfdir/pb.conf\n";
    7083
    7184    # Produce the man page for pb.conf
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2063 r2136  
    3333 
    3434our @ISA = qw(Exporter);
    35 our @EXPORT = qw(pb_distro_init pb_distro_conffile pb_distro_get pb_distro_getlsb pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_setuposrepo pb_distro_get_param pb_distro_get_context pb_distro_to_keylist pb_distro_conf_print pb_apply_conf_proxy);
     35our @EXPORT = qw(pb_distro_init pb_distro_conffile pb_distro_sysconffile pb_distro_get pb_distro_getlsb pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_setuposrepo pb_distro_get_param pb_distro_get_context pb_distro_to_keylist pb_distro_conf_print pb_apply_conf_proxy);
    3636($VERSION,$REVISION) = pb_version_init();
    3737
     
    7878
    7979return("CCCC/pb.conf");
     80}
     81
     82=item B<pb_distro_sysconffile>
     83
     84This function returns the optional configuration file used for local customization
     85
     86=cut
     87
     88sub pb_distro_sysconffile {
     89
     90return("SSSS/pb.conf");
    8091}
    8192
     
    122133# depending whether we deal with package install or tar file install
    123134pb_conf_add(pb_distro_conffile());
     135
     136# Similarly for the local file available for sysadmin. After the previous one to allow overwrite to work
     137pb_conf_add(pb_distro_sysconffile());
    124138
    125139# If we don't know which distribution we're on, then guess it
  • pbconf/devel/ProjectBuilder/deb/project-builder.dirs

    r867 r2136  
    22usr/share/perl
    33usr/share/man
     4usr/share/pb
    45etc/pb
  • pbconf/devel/ProjectBuilder/deb/rules

    r1878 r2136  
    2727
    2828        # Add here commands to compile the package.
    29         $(PERL) Makefile.PL CONFDIR=/etc/pb INSTALLDIRS=vendor  PBKEYWORD=$(CURDIR)/PBFINALDIR MANDIR=/usr/share/man
     29        $(PERL) Makefile.PL CONFDIR=/usr/share/pb SYSCONFDIR=/etc/pb INSTALLDIRS=vendor  PBKEYWORD=$(CURDIR)/PBFINALDIR MANDIR=/usr/share/man
    3030        $(MAKE)
    3131        touch $@
  • pbconf/devel/ProjectBuilder/ebuild/ProjectBuilder.ebuild

    r2112 r2136  
    2121    dev-perl/Mail-Sendmail"
    2222# Targets for pb
    23 CONFDIR="/etc/pb"
     23CONFDIR="/usr/share/pb"
     24SYSCONFDIR="/etc/pb"
    2425MANDIR="/usr/share/man"
    2526
  • pbconf/devel/ProjectBuilder/pkg/pbbuild

    r884 r2136  
    33# $Id$
    44#
    5 perl Makefile.PL INSTALLDIRS=vendor CONFDIR=/etc/pb
     5perl Makefile.PL INSTALLDIRS=vendor SYSCONFDIR=/etc/pb CONFDIR=/usr/share/pb
    66make
    77make DESTDIR=$1 install
  • pbconf/devel/ProjectBuilder/rpm/perl-ProjectBuilder.spec

    r2100 r2136  
    3131
    3232%build
    33 PBPERLCMD Makefile.PL INSTALLDIRS=vendor PBKEYWORD=${RPM_BUILD_ROOT}/PBFINALDIR CONFDIR=%{_sysconfdir}/pb MANDIR=%{_mandir}
     33PBPERLCMD Makefile.PL INSTALLDIRS=vendor PBKEYWORD=${RPM_BUILD_ROOT}/PBFINALDIR SYSCONFDIR=%{_sysconfdir}/pb CONFDIR=%{_datadir}/pb MANDIR=%{_mandir}
    3434make %{?_smp_mflags}
    3535
     
    4949%doc NEWS AUTHORS
    5050%doc COPYING README
     51%config %{_datadir}/pb
    5152%config(noreplace) %{_sysconfdir}/pb
    5253
  • pbconf/devel/pbmkbm/pkg/pbbuild

    r1341 r2136  
    33# $Id$
    44#
    5 perl Makefile.PL INSTALLDIRS=vendor CONFDIR=/etc/pb
     5perl Makefile.PL INSTALLDIRS=vendor SYSCONFDIR=/etc/pb CONFDIR=/usr/share/pb
    66make
    77make DESTDIR=$1 install
  • pbconf/devel/project-builder/pkg/pbbuild

    r884 r2136  
    33# $Id$
    44#
    5 perl Makefile.PL INSTALLDIRS=vendor CONFDIR=/etc/pb
     5perl Makefile.PL INSTALLDIRS=vendor SYSCONFDIR=/etc/pb CONFDIR=/usr/share/pb
    66make
    77make DESTDIR=$1 install
  • pbconf/devel/rpmbootstrap/pkg/pbbuild

    r972 r2136  
    33# $Id$
    44#
    5 perl Makefile.PL INSTALLDIRS=vendor CONFDIR=/etc/pb
     5perl Makefile.PL INSTALLDIRS=vendor SYSCONFDIR=/etc/pb CONFDIR=/usr/share/pb
    66make
    77make DESTDIR=$1 install
Note: See TracChangeset for help on using the changeset viewer.