]> andersk Git - gssapi-openssh.git/blobdiff - setup/setup-openssh.pl
merging OPENSSH_5_2P1_SIMON_20090726_HPN13V6 to trunk:
[gssapi-openssh.git] / setup / setup-openssh.pl
index ea2df1d2e99c87ef7b6a56eadbc2da05ff458179..6a4cdd50db13f254b0dafc77ecf29ea87432baac 100644 (file)
@@ -35,18 +35,6 @@ use Getopt::Long;
 use Cwd;
 use Cwd 'abs_path';
 
-#
-# modify the ld library path for when we call ssh executables
-#
-
-$oldldpath = $ENV{LD_LIBRARY_PATH};
-$newldpath = "$gpath/lib";
-if (length($oldldpath) > 0)
-{
-    $newldpath .= ":$oldldpath";
-}
-$ENV{LD_LIBRARY_PATH} = "$newldpath";
-
 #
 # i'm including this because other perl scripts in the gpt setup directories
 # do so
@@ -76,7 +64,7 @@ my $myname = "setup-openssh.pl";
 
 $prefix = ${globusdir};
 $exec_prefix = "${prefix}";
-$bindir = "${exec_prefix}/bin";
+$bindir = "${exec_prefix}/bin/ssh.d";
 $sbindir = "${exec_prefix}/sbin";
 $sysconfdir = "$prefix/etc/ssh";
 $localsshdir = "/etc/ssh";
@@ -119,21 +107,22 @@ setPrivilegeSeparation(0);
 # point.
 #
 
-debug0("$myname: Configuring package 'gsi_openssh'...\n");
-debug0("---------------------------------------------------------------------\n");
+debug0("Configuring gsi_openssh\n");
+debug0("------------------------------------------------------------\n");
+debug0("Executing...\n");
 
 makeConfDir();
 copyPRNGFile();
 $keyhash = determineKeys();
 runKeyGen($keyhash->{gen});
-copyKeyFiles($keyhash->{copy});
+linkKeyFiles($keyhash->{link});
 copyConfigFiles();
 
 my $metadata = new Grid::GPT::Setup(package_name => "gsi_openssh_setup");
 
 $metadata->finish();
 
-debug1("\n");
+debug0("\n");
 debug0("Notes:\n\n");
 
 if ( getPrivilegeSeparation() )
@@ -146,8 +135,8 @@ elsif ( !getPrivilegeSeparation() )
 }
 
 debug0("  o GSI-OpenSSH website is <http://grid.ncsa.uiuc.edu/ssh/>.\n");
-debug0("---------------------------------------------------------------------\n");
-debug0("$myname: Finished configuring package 'gsi_openssh'.\n");
+debug0("------------------------------------------------------------\n");
+debug0("Finished configuring gsi_openssh.\n");
 
 exit;
 
@@ -425,22 +414,22 @@ sub findExecutable
     return "undef";
 }
 
-### copyKeyFiles( $copylist )
+### linkKeyFiles( $linklist )
 #
-# given an array of keys to copy, copy both the key and its public variant into
+# given an array of keys to link, link both the key and its public variant into
 # the gsi-openssh configuration directory.
 #
 
-sub copyKeyFiles
+sub linkKeyFiles
 {
-    my($copylist) = @_;
+    my($linklist) = @_;
     my($regex, $basename);
 
-    if (@$copylist)
+    if (@$linklist)
     {
-        debug1("Copying ssh host keys...\n");
+        debug1("Linking ssh host keys...\n");
 
-        for my $f (@$copylist)
+        for my $f (@$linklist)
         {
             $f =~ s:/+:/:g;
 
@@ -449,8 +438,8 @@ sub copyKeyFiles
                 $keyfile = "$f";
                 $pubkeyfile = "$f.pub";
 
-                copyFile("$localsshdir/$keyfile", "$sysconfdir/$keyfile");
-                copyFile("$localsshdir/$pubkeyfile", "$sysconfdir/$pubkeyfile");
+                linkFile("$localsshdir/$keyfile", "$sysconfdir/$keyfile");
+                linkFile("$localsshdir/$pubkeyfile", "$sysconfdir/$pubkeyfile");
             }
         }
     }
@@ -595,10 +584,10 @@ sub determineKeys
 
     $keyhash = {};
     $keyhash->{gen} = [];   # a list of keytypes to generate
-    $keyhash->{copy} = [];  # a list of files to copy from the 
+    $keyhash->{link} = [];  # a list of files to link
 
     $genlist = $keyhash->{gen};
-    $copylist = $keyhash->{copy};
+    $linklist = $keyhash->{link};
 
     #
     # loop over our keytypes and determine what we need to do for each of them
@@ -632,16 +621,16 @@ sub determineKeys
         }
 
         #
-        # if we can find a copy of the keys in /etc/ssh, we'll copy them to the user's
+        # if we can find a copy of the keys in /etc/ssh, we'll link them to the user's
         # globus location
         #
 
         $mainkeyfile = "$localsshdir/$basekeyfile";
         $mainpubkeyfile = "$localsshdir/$basekeyfile.pub";
 
-        if ( isReadable($mainkeyfile) && isReadable($mainpubkeyfile) )
+        if ( isPresent($mainkeyfile) && isPresent($mainpubkeyfile) )
         {
-            push(@$copylist, $basekeyfile);
+            push(@$linklist, $basekeyfile);
             $count++;
             next;
         }
@@ -887,6 +876,29 @@ sub copyConfigFiles
     copySXXScript("$setupdir/SXXsshd.in", "$sbindir/SXXsshd");
 }
 
+### linkFile( $src, $dest )
+#
+# create a symbolic link from $src to $dest.
+#
+
+sub linkFile
+{
+    my($src, $dest) = @_;
+
+    if ( !isPresent($src) )
+    {
+        debug1("$src is not readable... not creating $dest.\n");
+        return;
+    }
+
+    if ( !prepareFileWrite($dest) )
+    {
+        return;
+    }
+
+    action("ln -s $src $dest");
+}
+
 ### copyFile( $src, $dest )
 #
 # copy the file pointed to by $src to the location specified by $dest.  in the
@@ -1059,11 +1071,11 @@ sub action
 
     debug1("$command\n");
 
-    my $result = system("LD_LIBRARY_PATH=\"$gpath/lib:\$LD_LIBRARY_PATH\"; $command >/dev/null 2>&1");
+    my $result = system("$command >/dev/null 2>&1");
 
     if (($result or $?) and $command !~ m!patch!)
     {
-        exitDie("ERROR: Unable to execute command: $!\n");
+        exitDie("ERROR: Unable to execute $command: $!\n");
     }
 }
 
This page took 0.044021 seconds and 4 git commands to generate.