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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
#!/usr/bin/perl
#
# CFINGERD Configuration Script
# Version 3.0 by Ken Hollis <khollis@bitgate.com>
#
# This program is GPLed. Please read LICENSE for more information.
# Copyright (C) 1996, Bitgate Software.
require 'perl/question.pl';
require 'perl/filemagic.pl';
require 'perl/gethost.pl';
require 'perl/generic.pl';
$VERSION = "1.3.2";
$| = 1;
sub show_header {
system("clear");
&disp_file("config/header");
}
sub show_footer {
&disp_file("config/footer");
}
sub make_config {
print "Creating src/config.h ... ";
local($dateandtime) = `date`;
chop($dateandtime);
$define_bsd = "\n\37ifndef BSD\n\37define BSD 1\n\37endif\n";
($uid,$gid) = split(',', $nobody);
open(CF, "src/config.h.in");
open(CFO, ">src/config.h");
while(<CF>) {
chop;
s/\$0//;
s/\$1/#define\tNOBODY_UID\t\t$uid/;
s/\$2/#define\tNOBODY_GID\t\t$gid/;
s/\$3/#define\tCOMPILE_DT\t\t\"$dateandtime\"/;
s/\$4/#define\tWTMPFILE\t\t"$lastlog"/;
if ($lastlog ne "/var/log/lastlog") {
s/\$5/#undef\tUSE_LASTLOG/;
} else {
s/\$5/#define\tUSE_LASTLOG\t\t1/;
}
if ($shadow eq "Y") {
s/\$6/#define\tHAS_SHADOW\t\t1/;
} else {
s/\$6/#undef\tHAS_SHADOW/;
}
if (getgrnam("tty")) {
s/\$7/#define\tHAS_TTY_GROUP\t\t1/;
} else {
s/\$7/#undef\tHAS_TTY_GROUP/;
}
print CFO "$_\n";
}
print CFO $define_bsd if $make eq "gmake";
close(CFO);
close(CF);
print "created.\n";
}
sub make_userlist {
print "Creating userlist/config.h ... ";
open(CF, "userlist/config.h.in");
open(CFO, ">userlist/config.h");
while(<CF>) {
chop;
s/\$0//;
print CFO "$_\n";
}
print CFO $define_bsd if $make eq "gmake";
close(CFO);
close(CF);
print "created.\n";
}
sub make_makefile {
print "Creating Makefile ... ";
open(CF, "Makefile.in");
open(CFO, ">Makefile");
while(<CF>) {
chop;
s/\$0/$make/;
print CFO "$_\n";
}
close(CF);
close(CFO);
print "created.\n";
}
sub configure {
unlink("config.h");
unlink("userlist/config.h");
$go_on = &check_exist("1", "./Makefile", "totally clean installation", "config/makewarn");
if ($go_on eq "Y") {
} else {
&disp_file("config/cancelled");
exit;
}
# $domain = &get_fqdn("FQDN?", "config/fqdn");
system("clear");
$os_type = &get_os;
$lastlog = &get_lastlog;
$nobody = &get_nobody;
$shadow = &has_shadow;
if ($os_type eq "LINUX") {
$make = "make";
} else {
$make = "gmake";
}
print "\n";
&make_config;
&make_userlist;
&make_makefile;
}
&show_header;
&configure;
&show_footer;
|