Re: backup to vmlinuz.fou4s ?

Lars Ellenberg <[email protected]> Sat, 23 Oct 2004 19:53:07 +0200
Newsgroups gmane.linux.suse.fou4s.devel
Message-ID <[email protected]>
/ 2004-10-22 22:30:26 +0200
\ Markus Gaugusch:
> On Oct 14, Lars Ellenberg <[email protected]> wrote:
> 
> >btw, why not do
> >"rpm -ihv" if pgk == $KERNELPKG ?
> >I mean, for most packages it is best to do -Uhv.
> >but for some, like the kernel, it is probably good to do -ihv.
> I've found a bug in fou4s (thanks to Klaus Lehmann for reporting :) and it 
> doesn't like duplicate entries in the RPM database (causing wrong attempts 
> to update packages that already have the right version). A few other 
> people have reported this and I couldn't find the solution before.

If you give me an example, I'll try to find some workaround.

> >and, while looking at the code in rpmInstall(), I saw this strange
> >prefix="su - -c" handling.  I assume this whole thing is to get rid of
> >the gid=fou4s on install, while still have --test intstalls as normal
> >user possible?
> Right. I've also seen, that the su construct doesn't like the RPM 
> parameters (su: unknown option "-U") ... it's just broken, so I'm thankful 
> for your patches!

welcome.

it would have (almost) worked, it you had done it
not like       eval $prefix \"$cmd\"
but            eval $prefix "\"$cmd\""
or even better eval "$prefix \"$cmd\""

btw, in case you ever have paramters that include whitespace, or still
get problems with strange options:
    
do_it()
{
  if [ $EUID = 0 ] ; then
    su - root -c '$0 "$@"' -- "$@"
  else
    "$@"
  fi
}
do_it rpm -q --qf "name of package is %{NAME}\nversion is %{VERSION}-%{RELEASE}" bash

should pretty much do the trick once and for all.

the -- separates su options from bash arguments, the extra $0 in
front of the first "$@" is needed because of this:
        -c string If  the  -c option is present, then commands are
                 read from string.  If there are arguments  after
                 the  string, they are assigned to the positional
                 parameters, starting with $0.
                             ^^^^^^^^^^^^^^^^^

	lge
--