Skip to contentSkip to conversation

opkg: don't install update-alternatives script

PATCH New Martin Jansa 1 participant 2 messages Nov 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 6/51 opkg: don't install update-alternatives script

* it is copy of update-alternatives-cworth
* it's not what distribution specifies with virtual/update-alternatives(-native)
* make sure that update-alternatives-native is available for image creation (added to task-boot)

---
 recipes/opkg/opkg.inc                              |    5 +++--
 .../opkg/dont-install-update-alternatives.patch    |    6 ++++++
 recipes/tasks/task-boot.bb                         |    2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100644 recipes/opkg/opkg/dont-install-update-alternatives.patch
recipes/opkg/opkg.inc +3 -2
index d744e72..3b4cc35 100644
@@ -4,14 +4,15 @@ SECTION = "base"
 LICENSE = "GPL"
 DEPENDS = "curl gpgme"
 PV = "0.1.6+svnr${SRCPV}"
-INC_PR = "r16"
+INC_PR = "r17"
 
 FILESPATHPKG =. "opkg:"
 
 SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;proto=http \
 	file://opkg_unarchive.patch;patch=1;maxrev=201 \
 	file://opkg-intercept-cleanup.patch;patch=1 \
-	file://isatty.patch;patch=1"
+	file://isatty.patch;patch=1 \
+	file://dont-install-update-alternatives.patch;patch=1"
 
 SRC_URI += "file://configure"
 
recipes/opkg/opkg/dont-install-update-alternatives.patch new file +6 -0
new file mode 100644
index 0000000..4ab7707
@@ -0,0 +1,6 @@
+diff -uNr trunk.orig/utils/Makefile.am trunk/utils/Makefile.am
+--- trunk.orig/utils/Makefile.am	2009-10-24 00:55:25.000000000 +0200
++++ trunk/utils/Makefile.am	2009-11-11 16:56:00.000000000 +0100
+@@ -1 +1 @@
+-bin_SCRIPTS = update-alternatives opkg-key
++bin_SCRIPTS = opkg-key
recipes/tasks/task-boot.bb +1 -1
index 1a1b9f2..bdba970 100644
@@ -14,7 +14,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 
 # Make sure we build the kernel
-DEPENDS = "virtual/kernel"
+DEPENDS = "virtual/kernel virtual/update-alternatives-native"
 
 #
 # minimal set of packages - needed to boot
Signature · 1 line
1.6.5.3
#1 lore raw

PATCH 7/51 update-alternatives-cworth: use latest installed alternative

* if there is more alternatives with higest priority, use the one last in alternatives file (latest installed)
* if target exists and its directory, remove link, otherwise new alternative link is created inside that direstory

---
 .../update-alternatives-cworth.inc                 |    5 ++-
 .../update-alternatives.use.last.patch             |   34 ++++++++++++++++++++
 .../update-alternatives-cworth_0.99.154.bb         |    2 +
 3 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 recipes/update-alternatives/update-alternatives-cworth/update-alternatives.use.last.patch
recipes/update-alternatives/update-alternatives-cworth.inc +3 -2
index f23bfe8..e53e9dd 100644
@@ -1,7 +1,8 @@
 LICENSE = "GPL"
 SECTION = "base"
-SRC_URI = "${HANDHELDS_CVS};module=familiar/dist/ipkg;tag=${@'V' + bb.data.getVar('PV',d,1).replace('.', '-')}"
+SRC_URI = "${HANDHELDS_CVS};module=familiar/dist/ipkg;tag=${@'V' + bb.data.getVar('PV',d,1).replace('.', '-')} \
+           file://update-alternatives.use.last.patch;patch=1"
 S = "${WORKDIR}/ipkg/C"
 PACKAGE_ARCH = "all"
 
-PR = "r1"
+PR = "r2"
recipes/update-alternatives/update-alternatives-cworth/update-alternatives.use.last.patch new file +34 -0
new file mode 100644
index 0000000..7bd5bd2
@@ -0,0 +1,34 @@
+diff -uNr C.orig/update-alternatives C/update-alternatives
+--- C.orig/update-alternatives	2003-03-28 17:39:45.000000000 +0100
++++ C/update-alternatives	2009-09-17 16:46:59.000000000 +0200
+@@ -97,8 +97,8 @@
+ 
+ ##	path=`sed -ne "1!p" $ad/$name | sort -nr -k2 | head -1 | sed 's/ .*//'`
+ ## busybox safe:
+-	path=`sed -ne "1!p" $ad/$name | sed -e "s/\(.*\) \(.*\)/\2 \1/g" | sort -nr | head -n 1 | sed 's/[^ ]* //'`
+-	if [ -z "$path" ]; then
++	prio=`sed -ne "1!p" $ad/$name | sed -e "s/\(.*\) \(.*\)/\2 \1/g" | sort -nr | head -n 1 | sed 's/ [^ ]*$//'`
++	if [ -z "$prio" ]; then
+ 		echo "update-alternatives: removing $link as no more alternatives exist for it"
+ 		rm $ad/$name
+ 		if [ -L $link ]; then
+@@ -107,11 +107,19 @@
+ 		return 0
+ 	fi
+ 
++	## find last line with highest priority
++	path=`grep "${prio}$" $ad/$name | tail -n 1 | sed 's/ [^ ]*$//'`
++
+ 	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 -a -d $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
recipes/update-alternatives/update-alternatives-cworth_0.99.154.bb +2 -0
index 6cab1e5..c260e40 100644
@@ -2,6 +2,8 @@ require update-alternatives-cworth.inc
 
 RPROVIDES_${PN} = "update-alternatives"
 
+PR="r2"
+
 do_install () {
     install -d ${D}${sbindir} \
                ${D}${sysconfdir}/alternatives \
Signature · 1 line
1.6.5.3