From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6654511350878830592 X-Received: by 2002:a50:90f5:: with SMTP id d50mr645788eda.9.1549374161672; Tue, 05 Feb 2019 05:42:41 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:628b:: with SMTP id t11ls3941412ejk.1.gmail; Tue, 05 Feb 2019 05:42:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IbieK4NSXaDt6zddxW5+MTOH4Vb2R/mg6kowBNm7NYr6/49umBSS8Zpg+9WqqUVAJEo3SJX X-Received: by 2002:a17:906:6889:: with SMTP id n9mr606437ejr.4.1549374161228; Tue, 05 Feb 2019 05:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549374161; cv=none; d=google.com; s=arc-20160816; b=OBV4RyGNbZBGwKz3AHsHTP1bmFqLenaGfiuuc/MZ0o7GnMv7o3w5Z/fRO/fnl9qf+P j5+cBRo5a/a2vc7dIqC9+TBTkJK1vU5G588OI9qP+wzi12hqbVqHmm9/5vSQIaGoZ5Ui UxdbHiapI1sEYhxomMh+UnWEX3swIZtKaAfeeViUaKywdHWv2ttmNTvOXEa3hRrVC4Lb otKY099UMzzY5vs/7hIckNWf+OwtbHUxG89fXZ2mEXe5rRQvzga9uSX24vwUsGhfzBdp iDLG1FwA5sk+8LxlvYhMRCaskIj4QnyHpWPcfFGJtr5IAyP4Webl2F0SyV2w+Ow9FOtY aHYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=MQvsElYSroZDPeyAOuuAWyTLyGJdruOHjdllz6Af6Es=; b=Na7XGAOJijAZhLbpni8jNkHTz2X65jpdz3OaZL9c+URGtKDXCHKKxjFu8Ozum2Xi/X xAPfUg5e7GqGZxn9CmEe0phHdx4qyLjO+oHtNMK3xSb6Y5MkBGlHZvMNo5uuSNOLIUG+ cnEiQUpzNSRTTD1X5V3iAVjQJwfb3s9/TNSwkZKUuaNXqw5OeXu3cW/bUZjp4RXQ9yWV ljjKTVWrIGFpCiBdcrxb3bf7WUD1DskzrGiHz6KyEcy/uySVWXDtqEUB42pyYqx+kaGm hba1hrfeD84VqfFWQRsGZU8lJN4XMJmSCR6cDLci6P7hgwfVvZ1o2PNO8MJaEssKxGwo 6GDg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) 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 b64si70272edf.5.2019.02.05.05.42.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 05:42:41 -0800 (PST) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) 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 x15Dgd24016340 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Feb 2019 14:42:40 +0100 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.69.181]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x15Dgc1t012842; Tue, 5 Feb 2019 14:42:39 +0100 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [RFC PATCH 2/2] meta: add isar-cfg-hostname recipe for setting the hostname Date: Tue, 5 Feb 2019 14:42:35 +0100 Message-Id: <20190205134235.27523-3-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190205134235.27523-1-claudius.heine.ext@siemens.com> References: <20190205134235.27523-1-claudius.heine.ext@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: L1XFHvjZu8DX From: Claudius Heine The isar-cfg-hostname recipe is a central point to set the hostname for images. It provides the `CFG_HOSTNAME` variables, which can be set from any `.conf` file or via `isar-cfg-hostname.bbappend` to the hostname that should be used. The default is 'isar'. Signed-off-by: Claudius Heine --- meta-isar/conf/local.conf.sample | 2 +- meta-isar/recipes-app/example-raw/files/postinst | 2 -- .../isar-cfg-hostname/files/postinst.tmpl | 8 ++++++++ .../isar-cfg-hostname/isar-cfg-hostname.bb | 16 ++++++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-support/isar-cfg-hostname/files/postinst.tmpl create mode 100644 meta/recipes-support/isar-cfg-hostname/isar-cfg-hostname.bb diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample index a2bdd7e..ddd15a4 100644 --- a/meta-isar/conf/local.conf.sample +++ b/meta-isar/conf/local.conf.sample @@ -162,7 +162,7 @@ CONF_VERSION = "1" # # The default list of extra packages to be installed. IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck \ - isar-cfg-rootpw" + isar-cfg-rootpw isar-cfg-hostname" # # Enable cross-compilation support diff --git a/meta-isar/recipes-app/example-raw/files/postinst b/meta-isar/recipes-app/example-raw/files/postinst index f48d993..a28afa3 100644 --- a/meta-isar/recipes-app/example-raw/files/postinst +++ b/meta-isar/recipes-app/example-raw/files/postinst @@ -14,5 +14,3 @@ if ! getent passwd isar >/dev/null; then fi chown -R isar:isar /var/lib/isar - -echo "isar" > /etc/hostname diff --git a/meta/recipes-support/isar-cfg-hostname/files/postinst.tmpl b/meta/recipes-support/isar-cfg-hostname/files/postinst.tmpl new file mode 100644 index 0000000..b46433b --- /dev/null +++ b/meta/recipes-support/isar-cfg-hostname/files/postinst.tmpl @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +if [ ! -e "/etc/hostname" ]; then + echo "${CFG_HOSTNAME}" > /etc/hostname +else + echo "/etc/hostname already exists, error" >&2 + exit -1 +fi diff --git a/meta/recipes-support/isar-cfg-hostname/isar-cfg-hostname.bb b/meta/recipes-support/isar-cfg-hostname/isar-cfg-hostname.bb new file mode 100644 index 0000000..aa41f73 --- /dev/null +++ b/meta/recipes-support/isar-cfg-hostname/isar-cfg-hostname.bb @@ -0,0 +1,16 @@ +# This software is a part of ISAR. + +DESCRIPTION = "Isar configuration package for hostname" +MAINTAINER = "isar-users " + +SRC_URI = "file://postinst.tmpl" + +TEMPLATE_FILES = "postinst.tmpl" +TEMPLATE_VARS = "CFG_HOSTNAME" +CFG_HOSTNAME ??= "isar" + +inherit dpkg-raw + +do_install() { + echo "intentionally left blank" +} -- 2.20.1