Not packaging the same file twice with different names: packaging kubectl plugins
Hi again, what is the currently recommended way to have a file installed by a package with two different names? Many kubectl plugins can be run standalone or as a kubectl plugin. The latter only works, if the binary name is kubectl-foo. My first idea: Package /usr/bin/foo and create a link to /usr/bin/kubectl-foo. But how to do that best? Spec? During package installation? Or is there a better approach? Thanks in advance! Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
On Fri, Feb 18, Johannes Kastl wrote:
Hi again,
what is the currently recommended way to have a file installed by a package with two different names?
Many kubectl plugins can be run standalone or as a kubectl plugin. The latter only works, if the binary name is kubectl-foo.
My first idea: Package /usr/bin/foo and create a link to /usr/bin/kubectl-foo. But how to do that best? Spec?
Build section in the spec file.
During package installation?
Never! There is no advantage about this, only disadvantages (file not owned by any RPM, thus the symlink will not be removed if you de-install the package, or fights with %ghost entries and %postun sections, ... Just create the symlink in the build section and add it to the filelist. Thorsten
Or is there a better approach?
Thanks in advance!
Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de
B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
-- Thorsten Kukuk, Distinguished Engineer, Senior Architect SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany Managing Director: Ivo Totev (HRB 36809, AG Nürnberg)
Hi Thorsten, On 18.02.22 at 14:39 Thorsten Kukuk wrote:
On Fri, Feb 18, Johannes Kastl wrote:
My first idea: Package /usr/bin/foo and create a link to /usr/bin/kubectl-foo. But how to do that best? Spec?
Build section in the spec file.
OK.
During package installation?
Never! There is no advantage about this, only disadvantages (file not owned by any RPM, thus the symlink will not be removed if you de-install the package, or fights with %ghost entries and %postun sections, ...
I was not sure if this could/should be done with update-alternatives or some similar automatism. Hence my question...
Just create the symlink in the build section and add it to the filelist.
Done, seems to work. https://build.opensuse.org/package/show/home:ojkastl_buildservice:Branch_dev... Thanks a lot! Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
participants (2)
-
Johannes Kastl
-
Thorsten Kukuk