ltib
[Top][All Lists]
Advanced

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

Re: [Ltib] %post spec section not expanded in rpm


From: Stuart Hughes
Subject: Re: [Ltib] %post spec section not expanded in rpm
Date: Fri, 12 Jun 2009 11:05:23 +0100
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

Hi Alex,

I can explain what's happening here. When you run -m scdeploy it fabricates an rpm spec file based on the input spec file to allow the files create in the install staging area to be put into the rootfs area. This "fabricated" spec file does not preserve the %post sections in the input spec file, which explains why do don't see any output from your query.

Theoretically if you could (or can) run the whole command from a pristine state (e.g. nothing in rpm/BUILD/<pkg>) then the %post section would be run on the version you have (from Freescale). However, it would always fail. The reason is that if you look you'll see in the install commands:

sudo /opt/freescale/ltib/usr/bin/rpm --root <rootfs>

What rpm actually does is chroot to the target rootfs. This would mean any commands in post would be run by busybox's /bin/sh built for powerpc. Clearly this won't work on your build machine.

As I said before, %pre/%post etc are now verboten (certainly for the target packages).

I think what you're trying to do is to get the module loaded at boot time. If this is the case, run ./ltib -m config and then navigate to:
--- Target System Configuration
        Options  --->
()  load these modules at boot

select this and enter the name of your kernel module (without the .ko extension IIRC).

Regards, Stuart

Badicioiu Alexandru wrote:
Hi Stuart,
thanks for your quick reply. I checked carefully the command line for rpm when the package is installed and it doesn't contain --noscripts switch. However, in the rpm file the %post should be expanded, if not prevented somehow in rpmbuild command. I didn't find anywhere how to disable %post processing in rpmbuild. What I want to do is to build an external package which contains a kernel module and after installation onto the rootfs to execute scripts to add the module in MODLIST variable in rc.conf on target rootfs and run depmod also.
Executing these actions in %post looked to me the way to do it.

These are the commands for ltib -p bpswitch.spec -m scbuild and
ltib -p bpswitch.spec -m scdeploy. The rpm builds and installs just fine, I 
omitted the output.

Processing: bpswitch
======================
Build path taken because: build key set,

rpmbuild --dbpath /home/alex/bhr/ltib-mpc8313erdb-20081222/rootfs//var/lib/rpm 
--target ppc --define '_unpackaged_files_terminate_build 0' --define 
'_target_cpu ppc' --define '__strip strip' --define '_topdir 
/home/alex/bhr/ltib-mpc8313erdb-20081222/rpm' --define '_prefix /usr' --define 
'_tmppath /home/alex/bhr/ltib-mpc8313erdb-20081222/tmp' --define '_mandir 
/usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bc 
--short-circuit  
/home/alex/bhr/ltib-mpc8313erdb-20081222/dist/lfs-5.1/bpswitch/bpswitch.spec

Processing: bpswitch
======================
Build path taken because: build key set,

rpmbuild --dbpath /home/alex/bhr/ltib-mpc8313erdb-20081222/rootfs//var/lib/rpm 
--target ppc --define '_unpackaged_files_terminate_build 0' --define 
'_target_cpu ppc' --define '__strip strip' --define '_topdir 
/home/alex/bhr/ltib-mpc8313erdb-20081222/rpm' --define '_prefix /usr' --define 
'_tmppath /home/alex/bhr/ltib-mpc8313erdb-20081222/tmp' --define '_mandir 
/usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bi 
--short-circuit  
/home/alex/bhr/ltib-mpc8313erdb-20081222/dist/lfs-5.1/bpswitch/bpswitch.spec

Processing: bpswitch
======================
Build path taken because: build key set, spec file newer than rpm,

rpmbuild --dbpath /home/alex/bhr/ltib-mpc8313erdb-20081222/rootfs//var/lib/rpm 
--target ppc --define '_unpackaged_files_terminate_build 0' --define 
'_target_cpu ppc' --define '__strip strip' --define '_topdir 
/home/alex/bhr/ltib-mpc8313erdb-20081222/rpm' --define '_prefix /usr' --define 
'_tmppath /home/alex/bhr/ltib-mpc8313erdb-20081222/tmp' --define '_mandir 
/usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bb 
--clean --rmsource  
/home/alex/bhr/ltib-mpc8313erdb-20081222/rpm/SPECS/bpswitch.spec

sudo /opt/freescale/ltib/usr/bin/rpm --root 
/home/alex/bhr/ltib-mpc8313erdb-20081222/rootfs --dbpath /var/lib/rpm -e 
--allmatches --nodeps --define '_tmppath /tmp/ltib' bpswitch 2>/dev/null

sudo /opt/freescale/ltib/usr/bin/rpm --root 
/home/alex/bhr/ltib-mpc8313erdb-20081222/rootfs --dbpath /var/lib/rpm --prefix 
/ --ignorearch -ivh --force --excludedocs --define '_tmppath /tmp/ltib' 
/home/alex/bhr/ltib-mpc8313erdb-20081222/rpm/RPMS/ppc/bpswitch-1.0-1.ppc.rpm
Preparing...                ########################################### [100%]
   1:bpswitch               ########################################### [100%]

--- On Fri, 6/12/09, Stuart Hughes <address@hidden> wrote:

From: Stuart Hughes <address@hidden>
Subject: Re: [Ltib] %post spec section not expanded in rpm
To: "Badicioiu Alexandru" <address@hidden>
Cc: address@hidden
Date: Friday, June 12, 2009, 3:43 AM
Hi Alex,

I recently updated ltib so it adds --noscripts to the rpm
install/erase commands.  This has the effect of not
running and pre/post preun/postun scripts in the spec
file.  I suspect that when you query the installed
package these are now not recorded and so you see no
output.

This is deliberate as another user correctly pointed out
this is a security risk.  I should also mention that
there are few instances where running these scripts makes
sense.

What are you trying to do, maybe there's another way to do
this.

Regards, Stuart

Badicioiu Alexandru wrote:
Hi, I'm trying to use %post section in an package spec
file, but the
corresponding script is not expanded in the generated
rpm file. Does
anybody know why it doesn't work? The spec file is the
one from
dist/lfs-5.1/hello/hello_mod.spec with an added %post
section. Doing
an /opt/freescale/ltib/usr/bin/rpm -qp --scripts on
the rpm file
shows no scripts are present.

Thank you.






_______________________________________________ LTIB
home page:
http://bitshrine.org

Ltib mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/ltib








reply via email to

[Prev in Thread] Current Thread [Next in Thread]