Skip to contentSkip to conversation

bash: Make it possible to run bash 3.2.48 instead of 4.2.

PATCH Superseded Martin Ertsaas 3 participants 4 messages Sep 18, 2012 – Sep 19, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bash: Make it possible to run bash 3.2.48 instead of 4.2.

bash-3.2.48 did not provide the linking from sh to bash, making it unusable. This patch fixes this. The reason for using 3.2.48 is that it is GPLv2 licensed, which 4.2 is not.

---
 meta/recipes-extended/bash/bash_3.2.48.bb |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
meta/recipes-extended/bash/bash_3.2.48.bb +15 -5
index 509d7a0..bab38a1 100644
@@ -6,7 +6,7 @@ LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=fd5d9bcabd8ed5a54a01ce8d183d592a"
 DEPENDS = "ncurses"
 
-PR = "r10"
+PR = "r11"
 
 SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \
            ${GNU_MIRROR}/bash/bash-3.2-patches/bash32-049;apply=yes;striplevel=0;name=patch001 \
@@ -25,16 +25,18 @@ SRC_URI[patch003.sha256sum] = "354886097cd95b4def77028f32ee01e2e088d58a98184fede
 SRC_URI[md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
 SRC_URI[sha256sum] = "128d281bd5682ba5f6953122915da71976357d7a76490d266c9173b1d0426348"
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
 
 PARALLEL_MAKE = ""
 
-bindir = "/bin"
-sbindir = "/sbin"
-
 EXTRA_OECONF = "--with-ncurses"
 export CC_FOR_BUILD = "${BUILD_CC}"
 
+ALTERNATIVE_${PN} = "sh"
+ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
+ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash"
+ALTERNATIVE_PRIORITY = "100"
+
 export AUTOHEADER = "true"
 
 do_configure_prepend () {
@@ -43,6 +45,14 @@ do_configure_prepend () {
 	fi
 }
 
+do_install_append () {
+	# Move /usr/bin/bash to /bin/bash, if need
+	if [ "${base_bindir}" != "${bindir}" ]; then
+		mkdir -p ${D}${base_bindir}
+		mv ${D}${bindir}/bash ${D}${base_bindir}
+	fi
+}
+
 pkg_postinst_${PN} () {
 	touch $D${sysconfdir}/shells
 	grep -q "bin/bash" $D${sysconfdir}/shells || echo /bin/bash >> $D${sysconfdir}/shells
Signature · 1 line
1.7.8.6
#1 lore raw
Quoted 7 lines · Martin Ertsaas

bash-3.2.48 did not provide the linking from sh to bash, making it unusable. This patch fixes this. The reason for using 3.2.48 is that it is GPLv2 licensed, which 4.2 is not.

---
  meta/recipes-extended/bash/bash_3.2.48.bb |   20 +++++++++++++++-----
  1 files changed, 15 insertions(+), 5 deletions(-)

Why can't this recipe use the base.inc file also? This seems to be duplicating the code in the .inc file.

Sau!

Quoted 52 lines
meta/recipes-extended/bash/bash_3.2.48.bb +15 -5
index 509d7a0..bab38a1 100644
@@ -6,7 +6,7 @@ LICENSE = "GPLv2+"
  LIC_FILES_CHKSUM = "file://COPYING;md5=fd5d9bcabd8ed5a54a01ce8d183d592a"
  DEPENDS = "ncurses"
 
-PR = "r10"
+PR = "r11"
 
  SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \
             ${GNU_MIRROR}/bash/bash-3.2-patches/bash32-049;apply=yes;striplevel=0;name=patch001 \
@@ -25,16 +25,18 @@ SRC_URI[patch003.sha256sum] = "354886097cd95b4def77028f32ee01e2e088d58a98184fede
  SRC_URI[md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
  SRC_URI[sha256sum] = "128d281bd5682ba5f6953122915da71976357d7a76490d266c9173b1d0426348"
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
 
  PARALLEL_MAKE = ""
 
-bindir = "/bin"
-sbindir = "/sbin"
-
  EXTRA_OECONF = "--with-ncurses"
  export CC_FOR_BUILD = "${BUILD_CC}"
 
+ALTERNATIVE_${PN} = "sh"
+ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
+ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash"
+ALTERNATIVE_PRIORITY = "100"
+
  export AUTOHEADER = "true"
 
  do_configure_prepend () {
@@ -43,6 +45,14 @@ do_configure_prepend () {
  	fi
  }
 
+do_install_append () {
+	# Move /usr/bin/bash to /bin/bash, if need
+	if [ "${base_bindir}" != "${bindir}" ]; then
+		mkdir -p ${D}${base_bindir}
+		mv ${D}${bindir}/bash ${D}${base_bindir}
+	fi
+}
+
  pkg_postinst_${PN} () {
  	touch $D${sysconfdir}/shells
  	grep -q "bin/bash" $D${sysconfdir}/shells || echo /bin/bash >> $D${sysconfdir}/shells
#2 lore raw
Quoted 11 lines · Saul Wold
Quoted 9 lines · Martin Ertsaas

bash-3.2.48 did not provide the linking from sh to bash, making it unusable.
This patch fixes this. The reason for using 3.2.48 is that it is GPLv2 licensed,
which 4.2 is not.

---
  meta/recipes-extended/bash/bash_3.2.48.bb |   20 +++++++++++++++-----
  1 files changed, 15 insertions(+), 5 deletions(-)
Quoted 4 lines

Why can't this recipe use the base.inc file also? This seems to be duplicating the code in the .inc file.

Sau!

We could of course do that, and then overwrite the license as the inc file is the one that says it's GPLv3. I however find that a bit confusing, as we will have two files to make bash-3.2.48, where one is saying it's GPLv3 and one saying it's GPLv2. The build system will understand it, but I don't think it's a nice solution.

Another solution would be to move the LICENSE part out of the inc file, and into the bash_4.2.bb file, which would completely eliminate both of our concerns about this. Any objections to doing that?

- Martin

Quoted 60 lines
Quoted 60 lines
meta/recipes-extended/bash/bash_3.2.48.bb +0 -0
index 509d7a0..bab38a1 100644
@@ -6,7 +6,7 @@ LICENSE = "GPLv2+"
  LIC_FILES_CHKSUM =

"file://COPYING;md5=fd5d9bcabd8ed5a54a01ce8d183d592a"
DEPENDS = "ncurses"

meta/recipes-extended/bash/bash_3.2.48.bb +1 -1
-PR = "r10"
+PR = "r11"
 
  SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \

${GNU_MIRROR}/bash/bash-3.2-patches/bash32-049;apply=yes;striplevel=0;name=patch001 \

meta/recipes-extended/bash/bash_3.2.48.bb +0 -0
@@ -25,16 +25,18 @@ SRC_URI[patch003.sha256sum] =

"354886097cd95b4def77028f32ee01e2e088d58a98184fede
SRC_URI[md5sum] = "338dcf975a93640bb3eaa843ca42e3f8" SRC_URI[sha256sum] =
"128d281bd5682ba5f6953122915da71976357d7a76490d266c9173b1d0426348"

meta/recipes-extended/bash/bash_3.2.48.bb +14 -4
-inherit autotools gettext
+inherit autotools gettext update-alternatives
 
  PARALLEL_MAKE = ""
 
-bindir = "/bin"
-sbindir = "/sbin"
-
  EXTRA_OECONF = "--with-ncurses"
  export CC_FOR_BUILD = "${BUILD_CC}"
 
+ALTERNATIVE_${PN} = "sh"
+ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
+ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash"
+ALTERNATIVE_PRIORITY = "100"
+
  export AUTOHEADER = "true"
 
  do_configure_prepend () {
@@ -43,6 +45,14 @@ do_configure_prepend () {
      fi
  }
 
+do_install_append () {
+    # Move /usr/bin/bash to /bin/bash, if need
+    if [ "${base_bindir}" != "${bindir}" ]; then
+        mkdir -p ${D}${base_bindir}
+        mv ${D}${bindir}/bash ${D}${base_bindir}
+    fi
+}
+
  pkg_postinst_${PN} () {
      touch $D${sysconfdir}/shells
      grep -q "bin/bash" $D${sysconfdir}/shells || echo /bin/bash >>

$D${sysconfdir}/shells

#3 lore raw
Quoted 1 line · Martin Ertsås

Another solution would be to move the LICENSE part out of the inc file,

thats ok.