Changeset 2136 in ProjectBuilder for devel/pb-modules


Ignore:
Timestamp:
Aug 28, 2016, 8:03:38 PM (8 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.

Location:
devel/pb-modules
Files:
2 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
Note: See TracChangeset for help on using the changeset viewer.