Patchwork [meta-java] openjdk: make the pkg_postinst work on busybox based systems

login
register
mail settings
Submitter Mariusz Ryndzionek
Date Jan. 14, 2014, 8:58 a.m.
Message ID <CADxgXkV-YtMG-GLbScW3We-GOekxE6=7cBENaoy2gxv8Lp2tMA@mail.gmail.com>
Download mbox | patch
Permalink /patch/64689/
State New, archived
Headers show

Comments

Mariusz Ryndzionek - Jan. 14, 2014, 8:58 a.m.
From cb6ebd77ca41e024f7168a1208523a81f158ed93 Mon Sep 17 00:00:00 2001
From: Mariusz Ryndzionek <mryndzionek@gmail.com>
Date: Tue, 14 Jan 2014 09:45:03 +0100
Subject: [PATCH] openjdk: make the pkg_postinst work on busybox based
systems

The 'head -1' option is not available on some busybox systems.
Change the command to 'head -n 1'.
---
 recipes-core/openjdk/openjdk-postinst.inc |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

           sed -i -e "/${FIRST_KNOWN}/d" -e
 "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         fi

@@ -29,7 +29,7 @@ pkg_postinst_${JDKPN}-vm-cacao () {
 pkg_prerm_${JDKPN}-vm-cacao () {
  sed -i -e "/^\-cacao.*/d" -e "/^$/d"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep
-q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
-          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -1`
+          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
           sed -i -e "/${FIRST_KNOWN}/d" -e
 "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         fi

@@ -47,7 +47,7 @@ pkg_postinst_${JDKPN}-vm-jamvm () {
 pkg_prerm_${JDKPN}-vm-jamvm () {
  sed -i -e "/^\-jamvm.*/d" -e "/^$/d"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep
-q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
-          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -1`
+          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
           sed -i -e "/${FIRST_KNOWN}/d" -e
 "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         fi

@@ -56,7 +56,7 @@ pkg_prerm_${JDKPN}-vm-jamvm () {

 pkg_postinst_${JDKPN}-vm-zero () {
         if grep -q "KNOWN" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg &&
grep -q "\-server ERROR" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
-           FIRST_KNOWN=`grep "KNOWN"
$D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -1`
+           FIRST_KNOWN=`grep "KNOWN"
$D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
            sed -i -e "/${FIRST_KNOWN}/d" -e "/^$/d"
$D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
            echo ${FIRST_KNOWN} >>
$D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         fi
@@ -67,7 +67,7 @@ pkg_postinst_${JDKPN}-vm-zero () {
 pkg_prerm_${JDKPN}-vm-zero () {
  sed -i -e "/^\-server.*/\-server ERROR"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
-          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -1`
+          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
           sed -i -e "/${FIRST_KNOWN}/d" -e
 "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         fi
 }

Patch

diff --git a/recipes-core/openjdk/openjdk-postinst.inc
b/recipes-core/openjdk/openjdk-postinst.inc
index e63a451..ad275d7 100644
--- a/recipes-core/openjdk/openjdk-postinst.inc
+++ b/recipes-core/openjdk/openjdk-postinst.inc
@@ -11,7 +11,7 @@  pkg_postinst_${JDKPN}-vm-shark () {
 pkg_prerm_${JDKPN}-vm-shark () {
  sed -i -e "/^\-shark.*/d" -e "/^$/d"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
         if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep
-q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
-          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -1`
+          FIRST_KNOWN=`grep "KNOWN"
${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`