]> andersk Git - gssapi-openssh.git/blame - setup/setup-openssh.pl
First swipe at a setup program for the openssh gpt package. Missing user prompts
[gssapi-openssh.git] / setup / setup-openssh.pl
CommitLineData
20d3226a 1#!/usr/bin/perl -w
2#
3# fixpaths - substitute makefile variables into text files
4
5#
6# Set up path prefixes for use in the path translations
7#
8
9$prefix = "/home/cphillip/gsi-openssh/install";
10$exec_prefix = "$prefix";
11$bindir = "$exec_prefix/bin";
12$libexecdir = "$exec_prefix/libexec";
13$sysconfdir = "$prefix/etc";
14$piddir = "/var/run";
15$xauth_path = "/usr/bin/X11/xauth";
16
17sub fixpaths
18{
19 #
20 # Set up path translations for the installation files
21 #
22
23 %def = (
24 "/etc/ssh_config" => "${sysconfdir}/ssh_config",
25 "/etc/ssh_known_hosts" => "${sysconfdir}/ssh_known_hosts",
26 "/etc/sshd_config" => "${sysconfdir}/sshd_config",
27 "/usr/libexec" => "${libexecdir}",
28 "/etc/shosts.equiv" => "${sysconfdir}/shosts.equiv",
29 "/etc/ssh_host_key" => "${sysconfdir}/ssh_host_key",
30 "/etc/ssh_host_dsa_key" => "${sysconfdir}/ssh_host_dsa_key",
31 "/etc/ssh_host_rsa_key" => "${sysconfdir}/ssh_host_rsa_key",
32 "/var/run/sshd.pid" => "${piddir}/sshd.pid",
33 "/etc/moduli" => "${sysconfdir}/moduli",
34 "/etc/sshrc" => "${sysconfdir}/sshrc",
35 "/usr/X11R6/bin/xauth" => "${xauth_path}",
36 "/usr/bin:/bin:/usr/sbin:/sbin" => "/usr/bin:/bin:/usr/sbin:/sbin:${bindir}",
37 );
38
39 print "dumping list of path translations..\n";
40 for $s (keys(%def))
41 {
42 print "$s = " . $def{$s} . "\n";
43 }
44
45 #
46 # Files on which to perform path translations
47 #
48
49 @files = (
50 "ssh_config",
51 "sshd_config",
52 "moduli",
53 "scp.1",
54 "ssh-add.1",
55 "ssh-agent.1",
56 "ssh-keygen.1",
57 "ssh-keyscan.1",
58 "ssh.1",
59 "sshd.8",
60 "sftp-server.8",
61 "sftp.1",
62 );
63
64 print "\ntranslating files..\n";
65 for $f (@files)
66 {
67 $f =~ /(.*\/)*(.*)$/;
68 $g = "$f.out";
69
70 open(IN, "<$f") || die ("$0: input file $f missing!\n");
71
72 if ( -e $g )
73 {
74 print "$g already exists, skipping.\n";
75 }
76 else
77 {
78 open(OUT, ">$g") || die ("$0: unable to open output file $g!\n");
79
80 while (<IN>)
81 {
82 for $s (keys(%def))
83 {
84 s#$s#$def{$s}#;
85 } # for $s
86 print OUT "$_";
87 } # while <IN>
88
89 close(OUT);
90 }
91
92 close(IN);
93 } # for $f
94
95 return 0;
96}
97
98sub runkeygen
99{
100 print "\nkey gen routine starting..\n";
101 if ( -e "${sysconfdir}/ssh_host_key" )
102 {
103 print "${sysconfdir}/ssh_host_key already exists, skipping.\n";
104 }
105 else
106 {
107 # if $sysconfdir/ssh_host_key doesn't exist..
108 system("$bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N \"\"");
109 }
110
111 if ( -e "${sysconfdir}/ssh_host_dsa_key" )
112 {
113 print "${sysconfdir}/ssh_host_dsa_key already exists, skipping.\n";
114 }
115 else
116 {
117 # if $sysconfdir/ssh_host_dsa_key doesn't exist..
118 system("$bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N \"\"");
119 }
120
121 if ( -e "${sysconfdir}/ssh_host_rsa_key" )
122 {
123 print "${sysconfdir}/ssh_host_rsa_key already exists, skipping.\n";
124 }
125 else
126 {
127 # if $sysconfdir/ssh_host_rsa_key doesn't exist..
128 system("$bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N \"\"");
129 }
130
131 return 0;
132}
133
134fixpaths();
135
136runkeygen();
This page took 0.440899 seconds and 5 git commands to generate.