Le lundi 10 juillet 2006 05:23, Erich Focht a écrit :
> Geoffroy,
>
> can you please explain why you replaced "dpkg --status $pkg" by
> "dpkg -l | grep $pkg" in all places?
>
> Was --status not working for you?

It does not work at all! Previously we were using dpkg --status $pkg, checking 
the stderr but dpkg return nothing on stderr, some text is just returned on 
stdout. So the best solution to know if a package is installed seems to check 
the list of installed packages. :-) BTW the explaination is in the check-in 
log and previously i added a comment in the code to explain that the 
implemented test does not work.

>
> Are you aware that your method is risky because "grep $pkg" can match more
> than $pkg? For example  "grep gtk" will match gtk, gtk2, gtk2-devel, etc,
> etc... That is why I consider --status the better choice, it matches
> exactly the package we want to know about.

A i said status does not work. I know the current solution is not perfect, i 
will try to improve it later but currently i am still working alone on the 
project i receive a lot of emails from users that want to have something 
running before to contribute so i want to go fast. And my solution is better 
than sonmething that does not work.
But if you have a quick fix i will be happy to implement it. :-)

>
> Regards,
> Erich
>
> On Monday 10 July 2006 05:52, Bernard Li wrote:
> > Hi Geoffroy:
> >
> > Seems to work, at least now I can bring up the OSCAR Wizard on Fedora
> > Core 5.
> >
> > Thanks,
> >
> > Bernard
> >
> > ________________________________
> >
> > From: Geoffroy VALLEE [mailto:[EMAIL PROTECTED]
> > Sent: Sun 09/07/2006 19:48
> > To: Bernard Li; [email protected]
> > Subject: Re: [Oscar-devel] [Oscar-checkins] r5114 - trunk
> >
> >
> >
> > Hi Bernard,
> >
> > I implemented and checked it in. I also checked-in an update version of
> > script/install_prereq which fixes bugs for Debian.
> >
> > Let me know if it brokes something (but it should not).
> >
> > Thanks,
> >
> > Le dimanche 9 juillet 2006 16:12, vous avez é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=121
> > > >642 _______________________________________________
> > > > 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=12164
> > >2 _______________________________________________
> > > 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

-- 
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