ltib
[Top][All Lists]
Advanced

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

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


From: Stuart Hughes
Subject: Re: [Ltib] Support for %Post section of .spec file?
Date: Tue, 16 Sep 2008 16:24:44 +0100

Hi Chip,

Generally speaking you can't add a %post section into the spec files
that LTIB uses.  The reason is that these are normally expected to be
run on the machine that *installs* the rpm, which in this case is the
host and therefore would not work.

Currently the easiest way to do this is to add your own rc.local (or
some other startup script) to do what you want (drop it into a merge
directory).

Regards, Stuart

On Tue, 2008-09-16 at 15:05 +0000, address@hidden wrote:
> 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
> 
> 
> _______________________________________________
> 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]