[libvirt] [PATCH] tools: unlink bash completion files before symlinking

Daniel P. Berrangé posted 1 patch 6 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180131173230.29099-1-berrange@redhat.com
tools/Makefile.am | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] tools: unlink bash completion files before symlinking
Posted by Daniel P. Berrangé 6 years, 1 month ago
"ln" will not replace an existing symlink, so if you run 'make install'
twice, the second time will get an error:

  ln: failed to create symbolic link 'virsh': File exists

We must always remove the symlink target first.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

Pushed as a build fix

 tools/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/Makefile.am b/tools/Makefile.am
index e173f56347..4c33e78a1d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -425,6 +425,7 @@ install-bash-completion:
 	$(INSTALL_SCRIPT) $(srcdir)/bash-completion/vsh \
 		"$(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh"
 	( cd $(DESTDIR)$(BASH_COMPLETIONS_DIR) && \
+		rm -f virsh virt-admin && \
 		$(LN_S) vsh virsh && \
 		$(LN_S) vsh virt-admin )
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: unlink bash completion files before symlinking
Posted by Erik Skultety 6 years, 1 month ago
On Wed, Jan 31, 2018 at 05:32:30PM +0000, Daniel P. Berrangé wrote:
> "ln" will not replace an existing symlink, so if you run 'make install'
> twice, the second time will get an error:
>
>   ln: failed to create symbolic link 'virsh': File exists
>
> We must always remove the symlink target first.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>
> Pushed as a build fix
>
>  tools/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index e173f56347..4c33e78a1d 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -425,6 +425,7 @@ install-bash-completion:
>  	$(INSTALL_SCRIPT) $(srcdir)/bash-completion/vsh \
>  		"$(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh"
>  	( cd $(DESTDIR)$(BASH_COMPLETIONS_DIR) && \
> +		rm -f virsh virt-admin && \

^This will get the job done, but what about using '-f' with ln instead?

Erik

>  		$(LN_S) vsh virsh && \
>  		$(LN_S) vsh virt-admin )

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: unlink bash completion files before symlinking
Posted by Daniel P. Berrangé 6 years, 1 month ago
On Thu, Feb 01, 2018 at 12:29:25PM +0100, Erik Skultety wrote:
> On Wed, Jan 31, 2018 at 05:32:30PM +0000, Daniel P. Berrangé wrote:
> > "ln" will not replace an existing symlink, so if you run 'make install'
> > twice, the second time will get an error:
> >
> >   ln: failed to create symbolic link 'virsh': File exists
> >
> > We must always remove the symlink target first.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >
> > Pushed as a build fix
> >
> >  tools/Makefile.am | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/Makefile.am b/tools/Makefile.am
> > index e173f56347..4c33e78a1d 100644
> > --- a/tools/Makefile.am
> > +++ b/tools/Makefile.am
> > @@ -425,6 +425,7 @@ install-bash-completion:
> >  	$(INSTALL_SCRIPT) $(srcdir)/bash-completion/vsh \
> >  		"$(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh"
> >  	( cd $(DESTDIR)$(BASH_COMPLETIONS_DIR) && \
> > +		rm -f virsh virt-admin && \
> 
> ^This will get the job done, but what about using '-f' with ln instead?

Either works, but I just copied what's done elsewhere in this
makefile.

> 
> Erik
> 
> >  		$(LN_S) vsh virsh && \
> >  		$(LN_S) vsh virt-admin )

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list