From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6449247988281769984 X-Received: by 10.25.29.147 with SMTP id d141mr2317698lfd.20.1501656921763; Tue, 01 Aug 2017 23:55:21 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.128.145 with SMTP id b139ls600948wmd.20.gmail; Tue, 01 Aug 2017 23:55:21 -0700 (PDT) X-Received: by 10.28.45.67 with SMTP id t64mr220845wmt.17.1501656921370; Tue, 01 Aug 2017 23:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501656921; cv=none; d=google.com; s=arc-20160816; b=nCt7Re+GgtsYCMfhnzBspPjgT8lKsKNDHdVoaAODC/h72tYc3u0fFsXgDtw1f+zR0r jvkwLFqPQ66qEHGrJu8PJB+KLzqLdwL76OiYKPpjKtB7QUzL6XnK58qJc3szBmx6hWnz D1t7aKPeYMazusw3ZLAekxiLv7aZAgbaOH9Wkx6N8IY2hNGgmTXasmX0XmYnF2f8FFoo XxgkT7r1rbZIpi/c3qkbZs/NGoGaKGZzEDA/YgfcWBttdDPAUA8plMogTVa+XXfGCEhA z9aiGVDU6rUGgjpjA+pPI5MKmaIBIVAK5XlODODbhmamR9qdD3xuLC9IfBVqGVm59bov pR+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=1MgMMp0FAghOrGTVpqVlh9sJpUAiyg/u2m7/VuTGAWw=; b=k9JnLcuNp7KlVJC/IVFLv+2/RJRu2RHIAygQvbhdjHJ/rxvn6tVDvB8z8CVjKHXt3z yAIikofFLabsRaQGpkQfNuyN2/c7+j+SK3HdJq8/1VJ2qemUHz2siuV3K7Be9dymTcp5 dEnUccDT8LDV+2sXqo92Kb+Sw1DKIqeuj11Ie4uRvlKYpdSY4AXqxbYXmMxJUPo0aP7Q 49yIJNfdFTuJF9+oYQ1wN/RDXXgB3lDwdhRcIBB+oK4nUgC5w3leV9JcYUx0cVrXTI3H BzCq4Km6Evq1L4jMoObdvq8adUvVfuc/cCPthH5ETD2ZpsO+ZLXd/fIwvyWz1k7WeFRN 6QQg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of claudius.heine.ext@siemens.com) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id m89si659301wmi.0.2017.08.01.23.55.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 23:55:21 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of claudius.heine.ext@siemens.com) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of claudius.heine.ext@siemens.com) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v726tKg1028436 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 2 Aug 2017 08:55:21 +0200 Received: from [139.25.68.223] (linux-ses-ext02.ppmd.siemens.net [139.25.68.223]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id v726tKLE017388; Wed, 2 Aug 2017 08:55:20 +0200 Subject: Re: [PATCH 16/16] recipes-app/hello-bin: add example on how to use dpkg-bin To: "[ext] Jan Kiszka" , "[ext] Henning Schild" , isar-users@googlegroups.com References: <071da159557fdf0987260a0ca20ff1be79cacbed.1501582237.git.henning.schild@siemens.com> From: Claudius Heine Message-ID: <9eb7bf64-33fc-a313-024e-6c691ace364a@siemens.com> Date: Wed, 2 Aug 2017 08:55:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: uOKJpRqT+maV On 08/02/2017 08:33 AM, [ext] Jan Kiszka wrote: > On 2017-08-01 12:17, [ext] Henning Schild wrote: >> Signed-off-by: Henning Schild >> --- >> meta-isar/recipes-app/hello-bin/files/README | 1 + >> meta-isar/recipes-app/hello-bin/files/postinst | 14 +++++++++++++ >> meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb | 26 ++++++++++++++++++++++++ >> 3 files changed, 41 insertions(+) >> create mode 100644 meta-isar/recipes-app/hello-bin/files/README >> create mode 100644 meta-isar/recipes-app/hello-bin/files/postinst >> create mode 100644 meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb >> >> diff --git a/meta-isar/recipes-app/hello-bin/files/README b/meta-isar/recipes-app/hello-bin/files/README >> new file mode 100644 >> index 0000000..6e2ce0f >> --- /dev/null >> +++ b/meta-isar/recipes-app/hello-bin/files/README >> @@ -0,0 +1 @@ >> +This is an example file that we get from FILESDIR in recipe. >> diff --git a/meta-isar/recipes-app/hello-bin/files/postinst b/meta-isar/recipes-app/hello-bin/files/postinst >> new file mode 100644 >> index 0000000..2a9eab6 >> --- /dev/null >> +++ b/meta-isar/recipes-app/hello-bin/files/postinst >> @@ -0,0 +1,14 @@ >> +#!/bin/sh >> + >> +set -e >> + >> +if ! getent group hello >/dev/null; then >> + addgroup --quiet --system hello >> +fi >> + >> +if ! getent passwd hello >/dev/null; then >> + adduser --system --ingroup hello --home /var/lib/hello hello \ >> + --gecos "My hello user" >> +fi >> + >> +chown -R hello:hello /var/lib/hello > > Nice. > >> diff --git a/meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb b/meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb >> new file mode 100644 >> index 0000000..5ff12d3 >> --- /dev/null >> +++ b/meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb >> @@ -0,0 +1,26 @@ >> +# Sample application using dpkg-bin, which turns a folder (${D}) of >> +# files into a .deb >> +# >> +# This software is a part of ISAR. >> + >> +DESCRIPTION = "Sample bin application for ISAR" >> +DEBIAN_MAINTAINER = "Your name here " >> + >> +inherit dpkg-bin >> + > > In contrast to OE/Yocto, we don't need to specify the files we want to > install later on here via SRC_URI? I'm not sure right now that we do not > lose some features when skipping this local fetching steps. The fetch step is still there, but it doesn't do anything because SRC_URI is empty. > >> + install -v -d ${D}/usr/local/bin/ >> + install -v -m 755 ${WORKDIR}/${PN} ${D}/usr/local/bin/${PN} >> + >> + bbnote "Now copy ${FILESDIR}/README to overlay" > > In OE, FILESDIR is deprecated and has been removed already. Probably not > a good idea to introduce it here. FILESPATH is now the standard. The README should be put into the SRC_URI and then fetched via the do_fetch step from the FILESDIR/FILESPATH into the WORKDIR. > However: > > "Usage of FILESPATH is discouraged, since it can make recipes harder > to bbappend. Instead FILESEXTRAPATHS should be used to extend the path." > >> + install -v -d ${D}/usr/local/doc/ >> + install -v -m 644 ${FILESDIR}/README ${D}/usr/local/doc/README-${P} >> + >> + bbnote "Now for a debian hook, see dpkg-deb" >> + install -v -m 755 ${FILESDIR}/postinst ${D}/DEBIAN/postinst > > Maybe this could be automated - to avoid boilerplate logic - by defining > some DEBIAN_POSTINST var. dpkg-bin could evaluate that var and install > everything mentioned in it without requiring the user to do this here > manually. Here is another idea, simpler but then you can put the additional steps easily into the recipe. Provide a variable to "${D}/DEBIAN/[postinst,...]" so you can simply do something like this: cat >${DEBIAN_POSTINST_FILE} </dev/null; then addgroup --quiet --system hello fi if ! getent passwd hello >/dev/null; then adduser --system --ingroup hello --home /var/lib/hello hello \ --gecos "My hello user" fi chown -R hello:hello /var/lib/hello EOF in the do_install step. This way you would have every step to setup the package and rootfs neatly in a single file and if this becomes to long, just add a file to the SRC_URI, fetch it to the workdir and copy/install it to this path in the do_install step. Cheers, Claudius