From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6521571834197966848 X-Received: by 10.80.149.81 with SMTP id v17mr916298eda.10.1518552329336; Tue, 13 Feb 2018 12:05:29 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.80.202.5 with SMTP id d5ls4344706edi.8.gmail; Tue, 13 Feb 2018 12:05:28 -0800 (PST) X-Google-Smtp-Source: AH8x224PNl8o3aAnxtJsLMBtkIWyBoOP27QtWW8i7zkMnxJ+7GbU/Z2c68fhxP4Gabw9S8HbfT6E X-Received: by 10.80.201.74 with SMTP id p10mr913498edh.7.1518552328685; Tue, 13 Feb 2018 12:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518552328; cv=none; d=google.com; s=arc-20160816; b=OPaVFFfQXxc5B/5xVk39kNm8hAjaZJ2Hppi79MvyfC8U9VT/3uGm4I3m1d2GVu1aqJ BzTMCVNq1KqRr1qX9TTvvTln5xUZg5iAHOwyaVlVUMyP/x09WAF337KghM+xhB+1okrP VUNG0pK1H4+HEsSLia3fi1L3IS+J1TvRkpKkEKEHvRykS2Y+YfsD7Gmh4ZBYPXBkA4T2 M1uhHvbYYMcpZQlkYYRvZfvbPsX4UHCalGgVg6NYD+6808N7AXDihrkM3klHoHc//79r 3gpZAoa/IILRRDg0L9+o8qimY2OqaUvjz4dz+BQLPOvLsR3V34J+qYsK/4zE4Ea8Dq3n IIdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:to:from:arc-authentication-results; bh=YRqzGhfkVj1Tp3htSdlHr+jc+A+aoY5Zp7QopXcv7WE=; b=DN0b6t3WokkXIg1wasc9pwM85etZahDKEiQEUpqI/9Bw9SY9TFe073fX1uN2Yy7fYF /esf17ki8uPwk/0j6UZwLY6j6xtK6QO5XGcLAywbd5KUsHc74uSjrE1FQgpHVMZSXinD xctXvUapFf6bvLF2+3ot+TAU6BlbrcOKSEBt59lon03b5iLefn7uMRWtHj/vmJMYb0qy 3JtRNJ3RzAi1ppYsBXk2YidF//w9TqnMuPS985oW9Kt3T6Z+ZMMTDFmt6HNF0wlwfVLI vmLAjm9iSzdUQJF7uUlY9MQOxedRLxFXKSlLeYvSZYE78cm0q0uFeusrPAd+p1RMA+7X ZZ9g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id g10si251332edm.0.2018.02.13.12.05.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 12:05:28 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w1DK5SId018518 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Feb 2018 21:05:28 +0100 Received: from md1f2u6c.ad001.siemens.net (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w1DK5Sue001776 for ; Tue, 13 Feb 2018 21:05:28 +0100 From: Jan Kiszka To: isar-users Subject: [PATCH v2 1/9] dpkg-raw: Install hooks automatically Date: Tue, 13 Feb 2018 21:05:19 +0100 Message-Id: <9aa55fd92f18b20e4d325a46de8dd9e177f4a16c.1518552327.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: X-TUID: TT3XwS23qUPs From: Jan Kiszka 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 --- 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