* [PATCH] dpkg-raw: Install hooks automatically
@ 2018-02-12 7:49 Jan Kiszka
0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2018-02-12 7:49 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
Simplify the process of adding a pre/postinst or -rm script to a
dpkg-raw package by auto-installing all files of that name from the
WORKDIR.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
In fact, no do_install should mess with the DEBIAN folder directly.
meta-isar/recipes-app/example-raw/example-raw_0.2.bb | 8 --------
meta-isar/recipes-app/example-raw/files/postinst | 4 ++++
meta/classes/dpkg-raw.bbclass | 5 ++++-
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.2.bb b/meta-isar/recipes-app/example-raw/example-raw_0.2.bb
index 657430e..9200e0d 100644
--- a/meta-isar/recipes-app/example-raw/example-raw_0.2.bb
+++ b/meta-isar/recipes-app/example-raw/example-raw_0.2.bb
@@ -25,14 +25,6 @@ do_install() {
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
-
- # this wins over meta-isar/recipes-core/images/files/*configscript.sh
- # but we take the same password for this example
- bbnote "Set the root password"
- echo 'echo "root:root" | chpasswd' >> ${D}/DEBIAN/postinst
-
bbnote "Now for a fake config file"
echo "# empty config file" > ${WORKDIR}/${PN}.conf
install -v -d ${D}/usr/local/etc/
diff --git a/meta-isar/recipes-app/example-raw/files/postinst b/meta-isar/recipes-app/example-raw/files/postinst
index a28afa3..b82fccd 100644
--- a/meta-isar/recipes-app/example-raw/files/postinst
+++ b/meta-isar/recipes-app/example-raw/files/postinst
@@ -14,3 +14,7 @@ if ! getent passwd isar >/dev/null; then
fi
chown -R isar:isar /var/lib/isar
+
+# this wins over meta-isar/recipes-core/images/files/*configscript.sh
+# but we take the same password for this example
+echo "root:root" | chpasswd
diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-raw.bbclass
index d132066..44aa078 100644
--- a/meta/classes/dpkg-raw.bbclass
+++ b/meta/classes/dpkg-raw.bbclass
@@ -35,7 +35,10 @@ do_deb_package_prepare() {
do
for a in inst rm
do
- chmod -f +x ${D}/DEBIAN/${t}${a} || true
+ if [ -f ${WORKDIR}/${t}${a} ]; then
+ install -v -m 755 ${WORKDIR}/${t}${a} \
+ ${D}/DEBIAN/${t}${a}
+ fi
done
done
}
--
2.13.6
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-12 7:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 7:49 [PATCH] dpkg-raw: Install hooks automatically Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox