-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.pl
executable file
·42 lines (34 loc) · 922 Bytes
/
config.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /usr/bin/env perl
use strict;
my $perlpath = shift;
my $bindir = shift;
my $mandir = shift;
my $sysconfdir = shift;
my $version = shift;
# read in yasql
open(YIN, "yasql.in") or die("Could not open yasql.in! $!");
# open yasql for writing
open(YOUT, ">yasql") or die("Could not open yasql for writing! $!");
flock(YOUT, 2) or die("Could not flock yasql! $!");
for(my $i = 0; <YIN>; $i++) {
if($i == 0) {
print YOUT "#!" . $perlpath . "\n";
} elsif(/^\$sysconfdir = /) {
print YOUT "\$sysconfdir = \"" . $sysconfdir . "\";\n";
} elsif(/^ \$VERSION = /) {
print YOUT " \$VERSION = \"" . $version . "\";\n";
} else {
print YOUT;
}
}
close(YOUT);
close(YIN);
eval {
require Pod::Man;
my $pod = Pod::Man->new(section=>1);
$pod->parse_from_file ('yasql', 'yasql.1');
};
if($@) {
warn "Generating man page failed, install Pod::Man to fix this"
}
print "Configuration successful\n";