Re: su | post section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, 02 April 2007, at 11:10:21 (+0530),
Lis Maria wrote:

> I am trying to run some sqls at the post installation of the RPM.At
> the beginning of the %post section, i am doing a su - <user> . But
> the sqls are getting executed as root itself. So if oracle home is
> not set in the root home, it will throw some error. and i cannot
> guarantee that oracle_home will be set for root in where all i
> install this RPM. How can i ensure that my sqls will get executed as
> the user to which i am switching to ??

When you use "su" in a shell script, you don't expect the rest of the
shell script to run as the su'd user, do you?  So why would you expect
a %post scriptlet to do it?

su - <user> -c /bin/sh -c "
  <sql commands here>
"

Something closer to that is what you need.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej@xxxxxxxxx>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "Men are not subtle.  We are obvious.  Women know what men want.  Men
  know what men want.  What do we want?  We want women!  That's it.
  It's the only thing we know for sure."             -- Jerry Seinfeld

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux