public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>,
	Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 11-16 of 16 v2 6/6] recipes-app/hello-bin: add example on how to use dpkg-bin
Date: Thu,  3 Aug 2017 21:15:24 +0200	[thread overview]
Message-ID: <c1de5435c44a9daeffe2b14c46efdf9ca6850ac4.1501787333.git.henning.schild@siemens.com> (raw)
In-Reply-To: <cover.1501787333.git.henning.schild@siemens.com>
In-Reply-To: <cover.1501787333.git.henning.schild@siemens.com>

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta-isar/recipes-app/hello-bin/files/README     |  1 +
 meta-isar/recipes-app/hello-bin/files/postinst   | 16 ++++++++++
 meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb | 38 ++++++++++++++++++++++++
 3 files changed, 55 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..a47abf3
--- /dev/null
+++ b/meta-isar/recipes-app/hello-bin/files/postinst
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+if ! getent group hello >/dev/null; then
+	addgroup --quiet --system hello
+fi
+
+if ! getent passwd hello >/dev/null; then
+	useradd --system --gid hello --create-home \
+		--home /var/lib/hello --no-user-group \
+		--comment "My hello user" \
+		hello
+fi
+
+chown -R hello:hello /var/lib/hello
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..d739dbf
--- /dev/null
+++ b/meta-isar/recipes-app/hello-bin/hello-bin_0.1.bb
@@ -0,0 +1,38 @@
+# 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"
+MAINTAINER = "Your name here <you@domain.com>"
+DEBIAN_DEPENDS = "apt"
+
+SRC_URI = "file://README \
+	   file://postinst"
+
+# we have to do that because we are using a broken unpack
+WORKDIR = "${BUILDROOT}"
+
+inherit dpkg-bin
+
+do_install() {
+	bbnote "Creating ${PN} binary"
+	echo "#!/bin/sh" > ${WORKDIR}/${PN}
+	echo "echo Hello World! ${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 faked 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
+}
-- 
2.13.0


      parent reply	other threads:[~2017-08-03 19:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 19:15 [PATCH 11-16 of 16 v2 0/6] and now for the second half Henning Schild
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 1/6] meta: dpkg rename install to package_write_deb Henning Schild
2017-08-08 13:06   ` Alexander Smirnov
2017-08-08 14:49     ` Henning Schild
2017-08-08 15:06       ` Alexander Smirnov
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 2/6] package_write_deb: change access rights on .debs Henning Schild
2017-08-08 13:16   ` Alexander Smirnov
2017-08-21 23:14   ` Baurzhan Ismagulov
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 3/6] meta: classes: move package_write_deb to new class isar-base-dpkg Henning Schild
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 4/6] meta: classes: rename dpkg to dpkg-src Henning Schild
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 5/6] meta: add dpkg-bin class Henning Schild
2017-08-03 19:15 ` Henning Schild [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1de5435c44a9daeffe2b14c46efdf9ca6850ac4.1501787333.git.henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=alex.bluesman.smirnov@gmail.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox