Patchwork [1/2] initscripts: use update-alternative to handle file functions

login
register
mail settings
Submitter Kang Kai
Date June 28, 2012, 9:35 a.m.
Message ID <4460a45a7ab14ef1075dd5a1ba27075e11d036b7.1340873279.git.kai.kang@windriver.com>
Download mbox | patch
Permalink /patch/30789/
State New
Headers show

Comments

Kang Kai - June 28, 2012, 9:35 a.m.
lsb need a more abundant /etc/init.d/functions file to handle lsb test.
Use update-alternative to install file funtions in package initscripts,
when package lsbinitscripts installed the file functions of
lsbinitscripts will be used.

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 meta/recipes-core/initscripts/initscripts_1.0.bb |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Richard Purdie - July 3, 2012, 1:53 p.m.
On Thu, 2012-06-28 at 17:35 +0800, Kang Kai wrote:
> lsb need a more abundant /etc/init.d/functions file to handle lsb test.
> Use update-alternative to install file funtions in package initscripts,
> when package lsbinitscripts installed the file functions of
> lsbinitscripts will be used.
> 
> Signed-off-by: Kang Kai <kai.kang@windriver.com>
> ---
>  meta/recipes-core/initscripts/initscripts_1.0.bb |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
> index 829694b..78c27a3 100644
> --- a/meta/recipes-core/initscripts/initscripts_1.0.bb
> +++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
> @@ -3,7 +3,7 @@ DESCRIPTION = "Initscripts provide the basic system startup initialization scrip
>  SECTION = "base"
>  LICENSE = "GPLv2"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
> -PR = "r134"
> +PR = "r135"
>  
>  INHIBIT_DEFAULT_DEPS = "1"
>  
> @@ -37,6 +37,12 @@ SRC_URI_append_arm = " file://alignment.sh"
>  
>  KERNEL_VERSION = ""
>  
> +inherit update-alternatives
> +
> +ALTERNATIVE_PRIORITY = "90"
> +ALTERNATIVE_${PN} = "functions"
> +ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
> +
>  HALTARGS ?= "-d -f"
>  
>  do_configure() {
> @@ -60,7 +66,7 @@ do_install () {
>  	install -d ${D}${sysconfdir}/default
>  	install -d ${D}${sysconfdir}/default/volatiles
>  
> -	install -m 0644    ${WORKDIR}/functions		${D}${sysconfdir}/init.d
> +	install -m 0644    ${WORKDIR}/functions		${D}${sysconfdir}/init.d/functions.${BPN}
>  	install -m 0755    ${WORKDIR}/bootmisc.sh	${D}${sysconfdir}/init.d
>  	install -m 0755    ${WORKDIR}/checkroot.sh	${D}${sysconfdir}/init.d
>  #	install -m 0755    ${WORKDIR}/finish.sh		${D}${sysconfdir}/init.d

Won't the code in the class handling this renaming itself?

Cheers,

Richard

Patch

diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 829694b..78c27a3 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -3,7 +3,7 @@  DESCRIPTION = "Initscripts provide the basic system startup initialization scrip
 SECTION = "base"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
-PR = "r134"
+PR = "r135"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
@@ -37,6 +37,12 @@  SRC_URI_append_arm = " file://alignment.sh"
 
 KERNEL_VERSION = ""
 
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "90"
+ALTERNATIVE_${PN} = "functions"
+ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
+
 HALTARGS ?= "-d -f"
 
 do_configure() {
@@ -60,7 +66,7 @@  do_install () {
 	install -d ${D}${sysconfdir}/default
 	install -d ${D}${sysconfdir}/default/volatiles
 
-	install -m 0644    ${WORKDIR}/functions		${D}${sysconfdir}/init.d
+	install -m 0644    ${WORKDIR}/functions		${D}${sysconfdir}/init.d/functions.${BPN}
 	install -m 0755    ${WORKDIR}/bootmisc.sh	${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/checkroot.sh	${D}${sysconfdir}/init.d
 #	install -m 0755    ${WORKDIR}/finish.sh		${D}${sysconfdir}/init.d