Yes makes sense... i will do it ASAP. 

Le dimanche 9 juillet 2006 16:12, Bernard Li a écrit :
> Hi Geoffroy:
>
> This seems like a chicken and egg problem - since OCA/OS_Detect needs
> $OSCAR_HOME to be set before it can be used.  In that case perhaps using
> OS_Detect to determine whether we are on Debian is not the best solution. 
> Perhaps you can simply check for the existence of /etc/profile.d?  As you
> mentioned this is does not exist on Debian, and I suppose if the directory
> exists, then we can use it.  This case is not specific to Debian, and could
> be used in the future for Slackware, Ubuntu, Gentoo etc. (if they also
> don't have /etc/profile.d).
>
> Makes sense?
>
> Cheers,
>
> Bernard
>
> ________________________________
>
> From: [EMAIL PROTECTED] on behalf of Geoffroy
> VALLEE Sent: Sun 09/07/2006 08:57
> To: [email protected]
> Subject: Re: [Oscar-devel] [Oscar-checkins] r5114 - trunk
>
>
>
> Hi Bernard,
>
> The reason i did that is explain in the code (comments) and you can find a
> high-level summary in the check-in log: to setup OSCAR_HOME you call
> oscar_home_env() which is based on /etc/profile.d, but for Debian-like
> distros you do not have this folder (and do not have to have one!). In
> order to put a case for Debian in the oscar_home_env() function, and do
> what we need to do, i need to know the current distro, therefore use
> OS_Detect.
>
> My mistake was to not unset OSCAR_HOME during my tests. What is the
> solution then since even the first lines of install_cluster are so
> dependent to policies from RPM based distros?
>
> Le samedi 8 juillet 2006 21:25, Bernard Li a écrit :
> > Hi Geoffroy:
> >
> > The call to OSCAR::OCA:OS_Detect::open() needs to come after
> > "&oscar_home_env()" since OCA requires $OSCAR_HOME to be defined.  Is
> > there any particular reason why you moved the call?
> >
> > To work around the issue, I just reverted that particular change (moved
> > the call back to the original location).
> >
> > Thanks,
> >
> > Bernard
> >
> > ________________________________
> >
> > From: [EMAIL PROTECTED] on behalf of
> > [EMAIL PROTECTED] Sent: Sat 08/07/2006 10:24
> > To: [EMAIL PROTECTED]
> > Subject: [Oscar-checkins] r5114 - trunk
> >
> >
> >
> > Author: valleegr
> > Date: 2006-07-08 13:24:10 -0400 (Sat, 08 Jul 2006)
> > New Revision: 5114
> >
> > Modified:
> >    trunk/install_cluster
> > Log:
> > [Debian Port] Management of the OSCAR_HOME environment variable.
> >
> > Modified: trunk/install_cluster
> > ===================================================================
> > --- trunk/install_cluster       2006-07-08 05:32:07 UTC (rev 5113)
> > +++ trunk/install_cluster       2006-07-08 17:24:10 UTC (rev 5114)
> > @@ -72,6 +72,8 @@
> >  # First of all, enforce that the user running this script is 'root'
> >  croak "You must be 'root' to run this script.  Aborting" if ($< != 0 ||
> > $ENV{'USER'} ne 'root');
> >
> > +my $os = OSCAR::OCA::OS_Detect::open();
> > +
> >  # Validate OSCAR_HOME environment variable and write /etc/profile.d
> > files &oscar_home_env();
> >
> > @@ -162,7 +164,6 @@
> >  # Check to see if this is a supported platform
> >
> >  oscar_log_subsection("Checking if this is a supported platform");
> > -my $os = OSCAR::OCA::OS_Detect::open();
> >  if (!$os) {
> >      print("ERROR: This is an unsupported system.  Specifically, no
> > module in OSCAR/OCA/OS_Detect positively identified this as a supported
> > system.\n"); die("Cannot continue");
> > @@ -310,41 +311,59 @@
> >      if (dirname($0) ne ".") {
> >         carp("You MUST execute the program from within the OSCAR top
> > level directory!\n"); }
> > -    # do profile.d files already exist?
> > -    my ($dir_csh, $dir_sh) = &profiled_files_read();
> > -    if ($dir_csh ne $dir_sh) {
> > -       print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
> > -       print "The /etc/profile.d/oscar_home.{csh,sh} files point to\n";
> > -       print "different \$OSCAR_HOME environment variables!\n";
> > -       print "Fix or delete them and rerun this program!\n";
> > -       print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
> > -       exit 1;
> > +
> > +    # Two situations now: we are using an RPM based distro therefore we
> > need to update /etc/profile.d/, or we are using a Debian-like distro and
> > therefore, we do not have a /etc/profile.d/ folder (see Debian policies
> > for more information), and we update /root/.bashrc +    # First case:
> > Debian-like distro
> > +    print "geof: $os->{distro}\n";
> > +    if ($os->{distro} eq "debian") {
> > +       print "Setup environment variables\n";
> > +       my $ret = `grep OSCAR /root/.bashrc`;
> > +       # We update /etc/.bashrc only if we did not do it before
> > +       if ($ret eq "") {
> > +               my $cmd4deb = "echo \"OSCAR_HOME=/root/oscar\nexport
> > OSCAR_HOME\n\" >> /root/.bashrc"; +               system ($cmd4deb);
> > +               $cmd4deb = "source /root/.bashrc";
> > +               system ($cmd4deb);
> > +       }
> >      }
> > -    # is there another OSCAR installation around?
> > -    if ($dir_sh && ($dir_sh ne $ohome)) {
> > -       print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
> > -       print "The /etc/profile.d/oscar_home.{csh,sh} files already
> > exist\n"; -       print "and point to a different OSCAR installation!\n";
> > -       print "If you want to DELETE the other OSCAR installation
> > (!!!)\n"; -       print "you should do:\n";
> > -       print "   cd $dir_sh\n";
> > -       print "   scripts/start_over\n";
> > -       print "Then rerun this script.\n";
> > -       print "ATTENTION: The steps described above will remove all
> > OSCAR\n"; -       print "packages and delete all defined cluster
> > nodes!\n"; -       print
> > "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; -       exit
> > 1;
> > +    # Second case RPM based distros
> > +    else {
> > +        # do profile.d files already exist?
> > +        my ($dir_csh, $dir_sh) = &profiled_files_read();
> > +        if ($dir_csh ne $dir_sh) {
> > +           print
> > "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; +
> > print "The /etc/profile.d/oscar_home.{csh,sh} files point to\n"; +
> >  print "different \$OSCAR_HOME environment variables!\n"; +          
> > print "Fix or delete them and rerun this program!\n";
> > +           print
> > "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; +
> > exit 1;
> > +       }
> > +       # is there another OSCAR installation around?
> > +       if ($dir_sh && ($dir_sh ne $ohome)) {
> > +           print
> > "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; +
> > print "The /etc/profile.d/oscar_home.{csh,sh} files already exist\n"; +
> >       print "and point to a different OSCAR installation!\n"; +
> > print "If you want to DELETE the other OSCAR installation (!!!)\n"; +
> >     print "you should do:\n";
> > +           print "   cd $dir_sh\n";
> > +           print "   scripts/start_over\n";
> > +           print "Then rerun this script.\n";
> > +           print "ATTENTION: The steps described above will remove all
> > OSCAR\n"; +           print "packages and delete all defined cluster
> > nodes!\n"; +           print
> > "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; +
> > exit 1;
> > +       }
> > +       # set environment variable OSCAR_HOME
> > +       if ($ENV{OSCAR_HOME} ne $ohome) {
> > +           oscar_log_subsection("Setting env variable OSCAR_HOME to
> > $ohome"); +           $ENV{OSCAR_HOME} = $ohome;
> > +       }
> > +       # write profile.d files
> > +       if (!$dir_sh || !$dir_csh) {
> > +           oscar_log_subsection("Generating
> > /etc/profile.d/oscar_home.{sh,csh} files."); +
> > &profiled_files_write($ohome);
> > +       }
> >      }
> > -    # set environment variable OSCAR_HOME
> > -    if ($ENV{OSCAR_HOME} ne $ohome) {
> > -       oscar_log_subsection("Setting env variable OSCAR_HOME to
> > $ohome"); -       $ENV{OSCAR_HOME} = $ohome;
> > -    }
> > -    # write profile.d files
> > -    if (!$dir_sh || !$dir_csh) {
> > -       oscar_log_subsection("Generating
> > /etc/profile.d/oscar_home.{sh,csh} files."); -      
> > &profiled_files_write($ohome);
> > -    }
> >  }
> >
> >  sub profiled_files_read {
> >
> >
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Oscar-checkins mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/oscar-checkins
>
> --
> Geoffroy R. Vallee, Ph.D.
> Oak Ridge National Laboratory        Voice: 865-574-3152
> P.O. Box 2008, Bldg. 5600               Fax: 865-576-5491
> Oak Ridge, TN 37831
>
> --
> Geoff
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Oscar-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oscar-devel

-- 
Geoff


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Oscar-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oscar-devel

Reply via email to