[oe-commits] Martin Jansa : Also remove existing link before linking new, because when its link to directory new link is created inside instead of replaced .

git version control git at git.openembedded.org
Fri Sep 18 08:50:42 UTC 2009


Module: openembedded.git
Branch: shr/import
Commit: f8f8db8031409a215be9b3242db40b6dd73a42c1
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=f8f8db8031409a215be9b3242db40b6dd73a42c1

Author: Martin Jansa <martin.jansa at gmail.com>
Date:   Fri Sep 18 00:01:01 2009 +0000

Also remove existing link before linking new, because when its link to directory new link is created inside instead of replaced.

Signed-off-by: Klaus Kurzmann <mok at fluxnetz.de>

---

 .../update-alternatives.use.last.patch             |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/recipes/update-alternatives/update-alternatives-cworth/update-alternatives.use.last.patch b/recipes/update-alternatives/update-alternatives-cworth/update-alternatives.use.last.patch
index 1c1fbea..c23c4f8 100644
--- a/recipes/update-alternatives/update-alternatives-cworth/update-alternatives.use.last.patch
+++ b/recipes/update-alternatives/update-alternatives-cworth/update-alternatives.use.last.patch
@@ -12,7 +12,7 @@ diff -uNr C.orig/update-alternatives C/update-alternatives
  		echo "update-alternatives: removing $link as no more alternatives exist for it"
  		rm $ad/$name
  		if [ -L $link ]; then
-@@ -107,6 +107,9 @@
+@@ -107,11 +107,19 @@
  		return 0
  	fi
  
@@ -22,3 +22,13 @@ diff -uNr C.orig/update-alternatives C/update-alternatives
  	if [ ! -e $link -o -L $link ]; then
  		local link_dir=`dirname $link`
  		if [ ! -d $link_dir ]; then
+ 			mkdir -p $link_dir
+ 		fi
++		if [ -h $link ]; then
++			# if $link exists and the target is directory, than ln -sf $path $link, doesn't replace link to that directory, but creates new link inside
++			echo "update-alternatives: Removing $link"
++			rm -f $link
++		fi
+ 		ln -sf $path $link
+ 		echo "update-alternatives: Linking $link to $path"
+ 	else





More information about the Openembedded-commits mailing list