File: Install

package info (click to toggle)
cfingerd 1.4.3-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 964 kB
  • sloc: ansic: 3,776; perl: 501; makefile: 137; sh: 73
file content (102 lines) | stat: -rwxr-xr-x 3,612 bytes parent folder | download | duplicates (11)
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
#!/usr/bin/perl
#
# Installation script for CFINGERD
# version 2.0.0 by Ken Hollis

$cfgpath = "/etc/cfingerd.conf";

if (open (C, "src/config.h")) {
    while (<C>) {
	/^#define\s+CFINGERD_CONF\s+(.*)$/ && ($cfgpath = $1);
    }
    close (C);
} else {
    print "Can't read src/config.h, using defaults.\n";
}

system("clear");
print "Welcome to Install for cfingerd 1.4.x.\n\n";

if ($ARGV[0] eq "-docs") {
    print "Force documentation install detected.\n\n";
}

if ($ARGV[0] ne "-docs") {
    if (-e "Makefile") {
	if (-e $cfgpath) {
	    print <<"EOT";
You already have a version of cfingerd.conf in the proper directory, which 
is where the normal configuration file is stored.  If you like, install 
will create a new configuration file for you, and save the old 
cfingerd.conf file as \"cfingerd.conf-old\" in case you need it for 
reference.

If you've previously had version 1.0.0 or below of cfingerd, this new 
cfingerd.conf file will be incompatible.
EOT
	    print "\nInstall new cfingerd.conf [Y]: ";
	    $doinst = <STDIN>;
	    chop($doinst);
	    $doinst =~ tr/a-z/A-Z/;
	    if (($doinst eq "Y") ||
		($doinst eq "YE") ||
		($doinst eq "YES") ||
		($doinst eq "")) {
		system("mv $cfgpath $cfgpath-old");
		system("cp -f cfingerd.conf $cfgpath");
		print "\nOkay, it's been copied, and the old one was copied to \"cfingerd.conf.old\".\n";
	    } else {
		print "Skipped.\n";
	    }
	} else {
	    print "Installing cfingerd.conf.\n";
	    system("cp -f cfingerd.conf $cfgpath");
	}
    } else {
	print "You need to compile cfingerd first!  Type \"Configure\" if you've not\n";
	print "already done so, then switch to root, and type \"make install\".\n";
	print "\nBesides, this script is automatically called from within the Makefile,\n";
	print "so there's no need for you to type it in manually.\n\n";
	exit;
    }

    system("rm -f /usr/man/man1/cfingerd.1");
    system("rm -f /usr/man/man1/cfingerd.conf.1");

    print "\nRemoved cfingerd and cfingerd.conf man pages from section 1 in case\n";
    print "they existed on your system.  (This may have been left over from an older\n";
    print "version.)  Old versions of cfingerd stored the manual pages in section 1.\n\n";
}

if ((-e "/etc/cfingerd") && ($ARGV[0] ne "-docs")) {
    print "Skipping the creation of your /etc/cfingerd directory, since it already\n";
    print "exists.  If you want, copy everything out of the texts directory into\n";
    print "the /etc/cfingerd root directory, and everything out of the scripts\n";
    print "directory into the /etc/cfingerd/scripts directory.\n";
} else {
    print "Creating /etc/cfingerd directory...\n";
    system("mkdir /etc/cfingerd");
    system("chmod 700 /etc/cfingerd");
    print "Copying over text files to the new directory...\n";
    system("cp -f texts/* /etc/cfingerd");
    print "Creating /etc/cfingerd/scripts directory...\n";
    system("mkdir /etc/cfingerd/scripts");
    system("chmod 700 /etc/cfingerd/scripts");
    print "Copying over the new scripts...\n";
    system("cp -f scripts/* /etc/cfingerd/scripts");
    system("chmod 700 /etc/cfingerd/scripts/*");
}

system("cp -f src/cfingerd /usr/sbin/in.cfingerd");

if ($ARGV[0] ne "-docs") {
    print "\nThat completes the installation.  Check the \"INSTALL\" file for information\n";
    print "on how to put cfingerd in your inetd.conf file.  If it's already there, it\n";
    print "should work fine.  With that in mind, simply test it with a \"finger @\".\n";
    print "\n";
    print "Hit [RETURN]: ";
    <STDIN>;
    print "\n";
} else {
    print "\nDocumentation installation complete.\n";
}