ltib
[Top][All Lists]
Advanced

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

[Ltib] Support for %Post section of .spec file?


From: ltib
Subject: [Ltib] Support for %Post section of .spec file?
Date: Tue, 16 Sep 2008 15:05:12 +0000

Hello Stuart,

I'm interested to know if it is feasible/sensible to add support for a %post 
section
in the RPM specfiles that we write and keep under 
.../dist/lfs-5.1/mypackage/mypackage.spec.

I have a package that needs to edit other files in the root file system after 
the binary
RPM is installed. Common examples of this might include adding a line to 
/etc/shells
or adding a daemon to the init scripts (as described in the LTIB FAQ).

I believe that the following 14-line patch to LTIB can accomplish most, if not 
all, of what I want.
It seems to work for me, but I am most interested to hear what you and others
think. (patch below)

Best Regards,

----
Chip Webb
CTO
Anue Systems
9111 Jollyville Rd, Suite 100
Austin, TX 78759



-----------------------------------------------------------------------------------------------------
--- main/bin/Ltibutils.pm       2008-09-16 04:56:33 UTC (rev 31624)
+++ main/bin/Ltibutils.pm       2008-09-16 04:59:01 UTC (rev 31625)
@@ -213,6 +213,8 @@
     m,^%prep(\s*.+?)(?:(^\s*$)|\Z),msi and do { $tokens->{prep} = $1 };
     m,^%build\s*(.+?)^\s*$,msi  and do { $tokens->{build} = $1 };
     m,^%install\s(.+?)^\s*$,msi and do { $tokens->{install} = $1 };
+    m,^%pre\s(.+?)^\s*$,msi and do { $tokens->{pre} = $1 };
+    m,^%post\s(.+?)^\s*$,msi and do { $tokens->{post} = $1 };
     m,^%files(\s*.+?)(?:(^\s*$)|\Z),msi and do { $tokens->{files} = $1 };
 
     # derive the directory name the package will build into

--- main/ltib   2008-09-16 04:56:33 UTC (rev 31624)
+++ main/ltib   2008-09-16 04:59:01 UTC (rev 31625)
@@ -840,7 +840,20 @@
 %Clean
 
 %Files$tok->{files}
+
 TXT
+    if($tok->{pre} ne ""){
+    print SPEC <<TXT;
+%Pre 
+$tok->{pre}
+TXT
+    }
+    if($tok->{post} ne ""){
+    print SPEC <<TXT;
+%Post 
+$tok->{post}
+TXT
+    }
     close SPEC;
 
     # invalidate the cache entry as we want to find the new one next




reply via email to

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