[PLDWWW] page changed: packages:alternatives

"Elan Ruusamäe (glen)" glen at pld-linux.org
Mon Feb 1 06:21:32 CET 2016



--- https://www.pld-linux.org/packages/alternatives?rev=1454303693
+++ https://www.pld-linux.org/packages/alternatives?rev=1454304092
@@ -3 +3,38 @@
  [[http://linux.die.net/man/8/update-alternatives|update-alternatives]] - maintain symbolic links determining default commands
+ 
+ ===== integrating =====
+ 
+ from [[http://git.pld-linux.org/?p=packages/php.git;a=commitdiff;h=82885e7c57e9ee9183eead2319352703c8278a35|phar-php example]]:
+ 
+ <code rpmspec>
+ Requires:      alternatives
+ ...
+ 
+ %install
+ ...
+ # touch for ghost
+ %{__rm} $RPM_BUILD_ROOT%{_bindir}/phar
+ touch $RPM_BUILD_ROOT%{_bindir}/phar
+ 
+ %post phar
+ update-alternatives \
+        --install %{_bindir}/phar phar %{_bindir}/phar%{ver_suffix}.phar %{ver_suffix} \
+        --slave %{_mandir}/man1/phar.1 phar.1 %{_mandir}/man1/phar%{ver_suffix}.1* || :
+ 
+ %postun phar
+ if [ $1 -eq 0 ]; then
+        update-alternatives --remove phar %{_bindir}/phar || :
+ fi
+ 
+ ...
+ %files
+ ...
+ %ghost %{_bindir}/phar
+ %ghost %{_mandir}/man1/phar.1
+ </code>
+ 
+   - add ''Requires: alternatives'' to runtime deps
+   - the path must be ghost and regular file, otherwise rpm will complin about file-conflicts
+   - use ''%%--install%%'' to setup the symlinks in package ''%post'' scriptlet.
+   - the ''%%--slave%%'' option is optional and may be repeated, use if you wish to "group" alternatives
+   - use proper ''%postun'' to remove alternative on package uninstall


Diff URL:
  https://www.pld-linux.org/packages/alternatives?do=diff&r1=1454303693&r2=1454304092
-- 
This mail was generated by DokuWiki at
https://www.pld-linux.org/


More information about the pld-cvs-commit mailing list