brentmaier has asked for the wisdom of the Perl Monks concerning the following question:

Hello... I'm creating a Perl wrapper that grabs code from any number of versions and allows the user to select an environment of which to compile their code on. The script makes modifications to the source, tar's, and ftp's it over to the compile environment. Now in RSHells hands now, I'm untaring, and attempting compile the code remotely via RSH. Once it compiles I have hopes to Tar and pull back the binaries to the original machine and then remove the remote source code.
make -f makefile.cfg sol make make install
The RSH fails because it isn't loading up .profile and whatever else to a standard user login level. I have tried performing these commands in an inline RSH command as well as putting them in a .sh file on the remote system and executing it via the RSH. I've even tried executing .profile in the .sh and running the make commands like this ". make -f makefile.cfg sol". After a successful compile, I want to grab the source and pull it back to the original box. Problem is getting the source to compile via an RSH command. Surely this can be done, how? I'm hoping someone can give me some input. Thank you ahead of time for your 2 cents. -Brent

Replies are listed 'Best First'.
Re: RSH calling a shell script .profile issue
by RMGir (Prior) on Mar 20, 2002 at 17:15 UTC
    You're doing this in a trusted environment, right?

    It doesn't sound like the kind of thing you'd want to expose on the internet :)

    Writing a "make" wrapper that loads the environment and then calls real make doesn't work?
    --
    Mike

      Most certainly it is in a trusted environment... You made me think twice about the post thinking I revealed hostnames.

      When you talk about a make wrapper, I was thinking that I loaded the profile when I attemted to run a .sh script on the remote system as opposed to running each make command via an RSH command. The .sh script was just simply to execute the three compile lines as a last ditch effort. In the .sh script, I attempted to have it load .profile and so forth prior to anything else getting executed. If you have a different idea on the "make wrapper", please give me an example I can run with.

      Assuming this doesn't work, I have kicked around the idea of using Rlogin and using Perl to echo the commands to the open Rlogin. Never done it but seems like an option. Rlogin should execute everything as though you logged into the machine.

      -Brent
        Like this:
        #!/bin/bash # or /bin/ksh, or .... # set this to the right home path HOME=/home/compileUser . ~/.profile cd pathToMakeIn make ...
        Make sense?
        --
        Mike
        Hello Mike... This worked, it's funny how simple it is to screw something up. I attempted to do what you suggested but I was missing one thing... The HOME= which was causing my problems either with .profile loading or how make was referencing HOME. Anyway, adding it took care of the problem. Meant to reply sooner but the page was really slow Friday... Thx again.
Re: RSH calling a shell script .profile issue
by traveler (Parson) on Mar 20, 2002 at 18:33 UTC
    My suggestion is to ensure that your Makefile has all the right settings for paths, etc. in it. You should not need the user's .profile or whatever. The .profile generally sets a path, aliases, etc. You should do that in your Makefile explicitly. That way you are sure the environment is correct. You could even take this one step further and use GNU configure to help ensure the correct environment.

    I would also include a target tar in the Makefile so you can say make tar when the compile is complete. Then you can rcp the tar file back.

    HTH, --traveler