]> andersk Git - gssapi-openssh.git/blobdiff - setup/setup-openssh.pl
Changes to when the GPT Setup package is included.
[gssapi-openssh.git] / setup / setup-openssh.pl
index b00eef25719db30e13655df82337c9932bdfc6fe..f0bc37264120f3fd54de07d54f109ec6ba6172cd 100644 (file)
@@ -1,16 +1,43 @@
 #!/usr/bin/perl -w
 #
-# fixpaths  - substitute makefile variables into text files
+# setup-openssh.pl - substitutes variables into text files and runs
+#                     ssh key gen programs
+#
+# adapted from 'fixpath', located in the openssh-3.0.2p1 package
+#
+
+$gpath = $ENV{GLOBUS_LOCATION};
+if (!defined($gpath))
+{
+    die "GLOBUS_LOCATION needs to be set before running this script"
+}
+
+#
+# i'm including this because other perl scripts in the gpt setup directories
+# do so
+#
+
+@INC = (@INC, "$gpath/lib/perl");
+
+require Grid::GPT::Setup;
+
+my $globusdir = $gpath;
+my $setupdir = "$globusdir/setup/globus";
+my $myname = "setup-openssh.pl";
+
+print "$myname: Configuring gsi-openssh package";
 
 #
 # Set up path prefixes for use in the path translations
 #
 
-$prefix = "/home/cphillip/gsi-openssh/install";
-$exec_prefix = "$prefix";
-$bindir = "$exec_prefix/bin";
-$libexecdir = "$exec_prefix/libexec";
-$sysconfdir = "$prefix/etc";
+$prefix = ${globusdir};
+$exec_prefix = "${prefix}";
+$bindir = "${exec_prefix}/bin";
+$mandir = "${prefix}/man";
+$mansubdir = "man";
+$libexecdir = "${exec_prefix}/libexec";
+$sysconfdir = "${prefix}/etc";
 $piddir = "/var/run";
 $xauth_path = "/usr/bin/X11/xauth";
 
@@ -36,60 +63,57 @@ sub fixpaths
         "/usr/bin:/bin:/usr/sbin:/sbin" => "/usr/bin:/bin:/usr/sbin:/sbin:${bindir}",
         );
 
-    print "dumping list of path translations..\n";
-    for $s (keys(%def))
-    {
-        print "$s = " . $def{$s} . "\n";
-    }
-
     #
     # Files on which to perform path translations
     #
 
     @files = (
-        "ssh_config",
-        "sshd_config",
-        "moduli",
-        "scp.1",
-        "ssh-add.1",
-        "ssh-agent.1",
-        "ssh-keygen.1",
-        "ssh-keyscan.1",
-        "ssh.1",
-        "sshd.8",
-        "sftp-server.8",
-        "sftp.1",
+        "${sysconfdir}/ssh_config",
+        "${sysconfdir}/sshd_config",
+        "${sysconfdir}/moduli",
+        "${mandir}/${mansubdir}1/scp.1",
+        "${mandir}/${mansubdir}1/ssh-add.1",
+        "${mandir}/${mansubdir}1/ssh-agent.1",
+        "${mandir}/${mansubdir}1/ssh-keygen.1",
+        "${mandir}/${mansubdir}1/ssh-keyscan.1",
+        "${mandir}/${mansubdir}1/ssh.1",
+        "${mandir}/${mansubdir}8/sshd.8",
+        "${mandir}/${mansubdir}8/sftp-server.8",
+        "${mandir}/${mansubdir}1/sftp.1",
         );
 
-    print "\ntranslating files..\n";
+    print "Translating strings in config/man files...\n";
     for $f (@files)
     {
         $f =~ /(.*\/)*(.*)$/;
-        $g = "$f.out";
+        $g = "$f.tmp";
 
-        open(IN, "<$f") || die ("$0: input file $f missing!\n");
-
-        if ( -e $g )
+        $result = system("mv $f $g");
+        if ($result != 0)
         {
-            print "$g already exists, skipping.\n";
+            die "Failed to copy $f to $g!\n";
         }
-        else
-        {
-            open(OUT, ">$g") || die ("$0: unable to open output file $g!\n");
 
-            while (<IN>)
+        open(IN, "<$g") || die ("$0: input file $g missing!\n");
+        open(OUT, ">$f") || die ("$0: unable to open output file $f!\n");
+
+        while (<IN>)
+        {
+            for $s (keys(%def))
             {
-                for $s (keys(%def))
-                {
-                    s#$s#$def{$s}#;
-                } # for $s
-                print OUT "$_";
-            } # while <IN>
-
-            close(OUT);
-        }
+                s#$s#$def{$s}#;
+            } # for $s
+            print OUT "$_";
+        } # while <IN>
 
+        close(OUT);
         close(IN);
+
+        $result = system("rm $g");
+        if ($result != 0)
+        {
+            die "Failed to remove $g\n";
+        }
     } # for $f
 
     return 0;
@@ -97,7 +121,7 @@ sub fixpaths
 
 sub runkeygen
 {
-    print "\nkey gen routine starting..\n";
+    print "Generating ssh keys (if necessary)...\n";
     if ( -e "${sysconfdir}/ssh_host_key" )
     {
         print "${sysconfdir}/ssh_host_key already exists, skipping.\n";
@@ -132,5 +156,8 @@ sub runkeygen
 }
 
 fixpaths();
-
 runkeygen();
+
+my $metadata = new Grid::GPT::Setup(package_name => "gsi-openssh-setup");
+
+$metadata->finish();
This page took 0.206115 seconds and 4 git commands to generate.