Re: [rpm] Correct way of writing spec file when packaging symlinks

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

 



%config is only to mark a file as a configuration file.

Specify symlinks the same way as any other file, RPM will get it right.

create the symlink in the %install section or the package won't be able to
own it.

For re-locateable the symlink must be relative, it can not be absolute.

ln -sf ../../foo %{buildroot}%{_datadir}/bar

Sorry for top-posting but I was replying to top-posting.

> I also have one further question.
>
> I was reading this stack overflow thread (
> http://stackoverflow.com/questions/7521980/packaging-symlinks-via-rpmbuild)
> and began to wonder if it is better to write spec file this way:
>
> %install
> rm -rf %{buildroot}
> mkdir %{buildroot}
> ln -sf /foo/bin %{buildroot}/bar/newbin
>
> %files
> /newbin
>
> Or is it better to put symlink creation in %post section:
>
> %post
> ln -sf /foo/bin /bar/newbin
>
> The problem that I'm having is that I can not create a relocatable rpm
> with
> either of the above options. If I use --prefix= during installation then
> the first option points to an invalid location and the second option fails
> with an error during installation but the rpm still gets installed so both
> cases fail but make some changes to file system.
>
> Can either of these options be made relocatable?
> For e.g. is there a variable that can be used in second case (something
> like ln -sf %{foo_prefix}/bin %{bar_prefix}/newbin so %{foo_prefix} and
> %{bar_prefix} get changed during rpm installation depending on specified
> prefixes?
>
> Thanks,
> Domen
>
>
>
> 2014-10-18 23:34 GMT+02:00 Domen Vrankar <domen.vrankar@xxxxxxxxx>:
>
>> Hi,
>>
>> I was searching the web and couldn't find an answer on how to correctly
>> write a spec file when packaging symlinks.
>>
>> One option that I found was
>>
>> %config /path/symlink
>>
>> and the other was simply
>>
>> /path/symlink
>>
>> Based on Documentation
>> http://www.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html
>> am I correct in assuming that the second version (without any % prefix)
>> is
>> the correct format?
>> Is there any difference in prefix if symlink points to directory or
>> file?
>>
>> Thanks,
>> Domen Vrankar
>>
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@xxxxxxxxxxxxx
> http://lists.rpm.org/mailman/listinfo/rpm-list
>

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/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