From fbf50895105e1d45fa0110e61cbe28e7d84ec0fa Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 28 Aug 2014 17:48:15 +0200 Subject: [PATCH] sysmobts-config: Add script with postinst hook Add post install script that will mangle the config to be the right one for the given machine. This will be executed once after the post installation. In case of the getty change the system must re-start once to be fully usable. E.g. for the sysmoBTS2050 the PA might not be powered up on first boot. --- .../files/sysmobts-post-install-config | 23 +++++++++++++++++++ .../sysmobts-config/sysmobts-config_1.bb | 21 +++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 recipes-sysmobts/sysmobts-config/files/sysmobts-post-install-config create mode 100644 recipes-sysmobts/sysmobts-config/sysmobts-config_1.bb diff --git a/recipes-sysmobts/sysmobts-config/files/sysmobts-post-install-config b/recipes-sysmobts/sysmobts-config/files/sysmobts-post-install-config new file mode 100644 index 0000000..d32f85f --- /dev/null +++ b/recipes-sysmobts/sysmobts-config/files/sysmobts-post-install-config @@ -0,0 +1,23 @@ +#!/bin/bash + + +prepare_sysmobts_2050() { + # Disable getty and mangle the config + /bin/systemctl mask serial-getty@ttyS0.service + + # We need to mange the systemd config file + sed -i s,#LogTarget=journal-or-kmsg,LogTarget=null, /etc/systemd/system.conf + sed -i s,#ShowStatus=yes,ShowStatus=no, /etc/systemd/system.conf + sed -i s,#DefaultStandardOutput=journal,DefaultStandardOutput=syslog, /etc/systemd/system.conf + sed -i s,#DefaultStandardError=inherit,DefaultStandardError=syslog, /etc/systemd/system.conf +} + + +# +MODEL=`/usr/bin/sysmobts-util -r model-nr` + +if [ $MODEL -eq "2050" ]; +then + echo "Going to fix the configuration for sysmobts-2050" + prepare_sysmobts_2050 +fi diff --git a/recipes-sysmobts/sysmobts-config/sysmobts-config_1.bb b/recipes-sysmobts/sysmobts-config/sysmobts-config_1.bb new file mode 100644 index 0000000..8114224 --- /dev/null +++ b/recipes-sysmobts/sysmobts-config/sysmobts-config_1.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "Script to mangle the configuration" +SECTION = "core" +LICENSE = "CLOSED" + +SRC_URI = "file://sysmobts-post-install-config" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/sysmobts-post-install-config ${D}${bindir}/ +} + +pkg_postinst_${PN} () { +if test "x$D" != "x"; then + exit 1 +else + echo "Going to run device specific post configuration" + /usr/bin/sysmobts-post-install-config +fi +} + +PACKAGE_ARCH = "all"