From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6460145516460113920 X-Received: by 10.28.45.71 with SMTP id t68mr103417wmt.17.1504539628805; Mon, 04 Sep 2017 08:40:28 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.46.13.1 with SMTP id 1ls43761ljn.15.gmail; Mon, 04 Sep 2017 08:40:28 -0700 (PDT) X-Google-Smtp-Source: ADKCNb53FDKqlIndpaNxQkmb/x1IRzjYbyvof0A62uzQeMKbazxKKBhUQcHyiIByYJDdzUgOyAxX X-Received: by 10.25.169.1 with SMTP id s1mr99451lfe.29.1504539628302; Mon, 04 Sep 2017 08:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504539628; cv=none; d=google.com; s=arc-20160816; b=Foq+nwqik3CMJ0s/yxsvYK7fguy7XjBmQidRmlByT8xTWPWgVZRJMVNNLFIoEoEvL9 Wfw5kjy+rJoBv0w4KIW9DPHRgaMn05a60nhKOnT2Y6eLgQDHxgpKPFdoj9Lto4ZsSQPD Mrin6BMVGlBeXCNjm5sLvawIEfk3bHJjjRJ2/49LfyQjqsHlhnghQ2KbJQVL9DbE9fzl /VQDOU2UsZioRwTCDCkzpeMEU3deaduT3cNmBxP0Gq7a9/V3zdz/6ZQ319x1DEsRVdIn nYUALDFj2lY7O1PeSJxjjTPbivUbDO+Mx2V63HobBGD2uzR/CwGf4agSZajgt7EwJqTO NBAQ== 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=s/wZ/WjDWn7wpEGdlb61/Sh4L/u49IuPowQDPwR9P/Y=; b=CXlyWCp40X7GELib9wyY0JFPHAtozCLmJFCKTX5wS7afK84o43456kJbVsGLHzhqH1 FqBKrocAOnlMIsaEe6Qxmadjy5Z+Bcdp04YlsitdwsaiXyiU7+guLQk06Dy2Sl2+AhP8 4P4Xl880W8UEzQ+++ncFBhWctB2tfCDhdZ1AScdK/aSzCSsdhaKixuOPNrmgiphWaUOz s2gYdMcZBaUWbJFM8GUj1APy9SfztZoqSe7O9MjXXxiUrteJYGspApMd6O915P6KcgPr O0X0JzaX4piPANwlSOBs1IyDvua6RD3/6XH6yG1jsAEy7GI+0zDiaDaZCSR489NxB7iM uWMA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id l67si463341wmb.3.2017.09.04.08.40.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 08:40:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from [10.0.2.15] ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id v84FePKC009054 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Mon, 4 Sep 2017 17:40:27 +0200 Subject: Re: [PATCH 6/6] recipes-app/example-custom: add example on how to use dpkg-custom To: isar-users@googlegroups.com References: <3dabf24441bb486c830ef72df228848206b1bef5.1504119538.git.henning.schild@siemens.com> From: Alexander Smirnov Message-ID: Date: Mon, 4 Sep 2017 18:40:20 +0300 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: <3dabf24441bb486c830ef72df228848206b1bef5.1504119538.git.henning.schild@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: l35ecMFJnV/f On 08/30/2017 10:03 PM, Henning Schild wrote: > Issue: > It might not be clear to a user how to make use of the class > dpkg-custom. > > Change: > Add an example that demonstrates some features. > > Impact: > This patch does not change the behaviour of Isar. It addresses the issue > partially, documentation would also be useful. > > Signed-off-by: Henning Schild > --- > .../example-custom/example-custom_0.1.bb | 35 ++++++++++++++++++++++ > meta-isar/recipes-app/example-custom/files/README | 1 + > .../recipes-app/example-custom/files/postinst | 16 ++++++++++ > 3 files changed, 52 insertions(+) > create mode 100644 meta-isar/recipes-app/example-custom/example-custom_0.1.bb > create mode 100644 meta-isar/recipes-app/example-custom/files/README > create mode 100644 meta-isar/recipes-app/example-custom/files/postinst > > diff --git a/meta-isar/recipes-app/example-custom/example-custom_0.1.bb b/meta-isar/recipes-app/example-custom/example-custom_0.1.bb > new file mode 100644 > index 0000000..efa813e > --- /dev/null > +++ b/meta-isar/recipes-app/example-custom/example-custom_0.1.bb > @@ -0,0 +1,35 @@ > +# Sample application using dpkg-custom, which turns a folder (${D}) of > +# files into a .deb > +# > +# This software is a part of ISAR. > + > +DESCRIPTION = "Sample application for ISAR" > +MAINTAINER = "Your name here " > +DEBIAN_DEPENDS = "apt" > + > +SRC_URI = "file://README \ > + file://postinst" > + > +inherit dpkg-custom > + > +do_populate_package() { > + bbnote "Creating ${PN} binary" > + echo "#!/bin/sh" > ${WORKDIR}/${PN} > + echo "echo Hello ISAR! ${PN}_${PV}" >> ${WORKDIR}/${PN} > + > + bbnote "Putting ${PN} into package" > + install -v -d ${D}/usr/local/bin/ > + install -v -m 755 ${WORKDIR}/${PN} ${D}/usr/local/bin/${PN} > + > + bbnote "Now copy ${FILESDIR}/README into package" > + install -v -d ${D}/usr/local/doc/ > + install -v -m 644 ${WORKDIR}/README ${D}/usr/local/doc/README-${P} > + > + bbnote "Now for a debian hook, see dpkg-deb" > + install -v -m 755 ${WORKDIR}/postinst ${D}/DEBIAN/postinst > + > + bbnote "Now for a fake config file" > + echo "# empty config file" > ${WORKDIR}/${PN}.conf > + install -v -d ${D}/usr/local/etc/ > + install -v -m 644 ${WORKDIR}/${PN}.conf ${D}/usr/local/etc/${PN}.conf > +} > diff --git a/meta-isar/recipes-app/example-custom/files/README b/meta-isar/recipes-app/example-custom/files/README > new file mode 100644 > index 0000000..6e2ce0f > --- /dev/null > +++ b/meta-isar/recipes-app/example-custom/files/README > @@ -0,0 +1 @@ > +This is an example file that we get from FILESDIR in recipe. > diff --git a/meta-isar/recipes-app/example-custom/files/postinst b/meta-isar/recipes-app/example-custom/files/postinst > new file mode 100644 > index 0000000..a28afa3 > --- /dev/null > +++ b/meta-isar/recipes-app/example-custom/files/postinst > @@ -0,0 +1,16 @@ > +#!/bin/sh > + > +set -e > + > +if ! getent group isar >/dev/null; then > + addgroup --quiet --system isar > +fi > + > +if ! getent passwd isar >/dev/null; then > + useradd --system --gid isar --create-home \ > + --home /var/lib/isar --no-user-group \ > + --comment "My isar user" \ > + isar > +fi > + > +chown -R isar:isar /var/lib/isar > That's a good demo scenario. But probably it makes sense to demonstrate it on real use case, for example set default password for root. This anyway should be done, probably it's a good time :-) -- With best regards, Alexander Smirnov