From 303106cce128e97bb21523c36f7caf194ee2a571 Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Mon, 17 Dec 2018 17:48:23 +0100 Subject: [PATCH] sumo migration: use pkg_postinst_ontarget() to delayed operation on first boot Signed-off-by: Arturo Buzarra --- .../u-boot/u-boot-fw-utils_2017.%.bbappend | 6 +----- .../recipes-aws/greengrass/greengrass_1.0.0.bb | 2 +- .../recipes-aws/greengrass/greengrass_1.1.0.bb | 2 +- .../recipes-aws/greengrass/greengrass_1.6.0.bb | 2 +- .../recipes-aws/greengrass/greengrass_1.7.0.bb | 2 +- .../hostapd/hostapd_%.bbappend | 14 ++++---------- .../base-files/base-files_3.0.14.bbappend | 2 +- .../init-ifupdown/init-ifupdown_1.0.bbappend | 6 +----- 8 files changed, 11 insertions(+), 25 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_2017.%.bbappend b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_2017.%.bbappend index 3c9270cd6..195bc2a01 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_2017.%.bbappend +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_2017.%.bbappend @@ -35,11 +35,7 @@ do_install_append() { install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/ } -pkg_postinst_${PN}() { - # run the postinst script on first boot - if [ x"$D" != "x" ]; then - exit 1 - fi +pkg_postinst_ontarget_${PN}() { CONFIG_FILE="/etc/fw_env.config" MMCDEV="$(sed -ne 's,.*root=/dev/mmcblk\([0-9]\)p.*,\1,g;T;p' /proc/cmdline)" if [ -n "${MMCDEV}" ]; then diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb index af6c86b35..43138de95 100644 --- a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb @@ -145,7 +145,7 @@ do_install() { sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/configuration/config.json } -pkg_postinst_${PN}() { +pkg_postinst_ontarget_${PN}() { # Enable protection for hardlinks and symlinks if ! grep -qs 'protected_.*links' $D${sysconfdir}/sysctl.conf; then cat >> $D${sysconfdir}/sysctl.conf <<-_EOF_ diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb index 3767b3e12..63140e6c2 100644 --- a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb @@ -147,7 +147,7 @@ do_install() { sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/config/config.json } -pkg_postinst_${PN}() { +pkg_postinst_ontarget_${PN}() { # Enable protection for hardlinks and symlinks if ! grep -qs 'protected_.*links' $D${sysconfdir}/sysctl.conf; then cat >> $D${sysconfdir}/sysctl.conf <<-_EOF_ diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.6.0.bb b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.6.0.bb index 5846bc92d..ba2ef5caa 100644 --- a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.6.0.bb +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.6.0.bb @@ -159,7 +159,7 @@ do_install() { sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/config/config.json } -pkg_postinst_${PN}() { +pkg_postinst_ontarget_${PN}() { # Enable protection for hardlinks and symlinks if ! grep -qs 'protected_.*links' $D${sysconfdir}/sysctl.conf; then cat >> $D${sysconfdir}/sysctl.conf <<-_EOF_ diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.7.0.bb b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.7.0.bb index 1d90363dd..b882717ca 100644 --- a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.7.0.bb +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.7.0.bb @@ -97,7 +97,7 @@ do_install() { sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/config/config.json } -pkg_postinst_${PN}() { +pkg_postinst_ontarget_${PN}() { # Enable protection for hardlinks and symlinks if ! grep -qs 'protected_.*links' $D${sysconfdir}/sysctl.conf; then cat >> $D${sysconfdir}/sysctl.conf <<-_EOF_ diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend index c3dd56f48..d660f911e 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend @@ -29,13 +29,9 @@ do_install_append_ccimx8x() { install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir} } -pkg_postinst_${PN}() { +pkg_postinst_ontarget_${PN}() { # Append the last two bytes of the wlan0 MAC address to the SSID of the # hostAP configuration files - # (execute on first boot) - if [ -n "$D" ]; then - exit 1 - fi # Get the last two bytes of the wlan0 MAC address MAC="$(cut -d ':' -f5,6 /sys/class/net/wlan0/address | tr -d ':')" @@ -48,11 +44,9 @@ pkg_postinst_${PN}() { find "${sysconfdir}" -type f -name 'hostapd_wlan?.conf' -exec \ sed -i -e "s,##MAC##,${MAC},g" {} \; - # Create the symlinks in the different runlevels + # Do not autostart hostapd daemon, it will conflict with wpa-supplicant. if type update-rc.d >/dev/null 2>/dev/null; then - update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} + # Remove all symlinks in the different runlevels + update-rc.d -f ${INITSCRIPT_NAME} remove fi } - -# Do not autostart hostapd daemon, it will conflict with wpa-supplicant. -INITSCRIPT_PARAMS = "remove" diff --git a/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend b/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend index 663657f08..60f38fef1 100644 --- a/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend +++ b/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend @@ -10,7 +10,7 @@ do_install_append() { install -m 0644 ${WORKDIR}/sysctl.conf ${D}${sysconfdir}/ } -pkg_postinst_${PN}_ccimx6() { +pkg_postinst_ontarget_${PN}_ccimx6() { get_emmc_block_device() { emmc_number="$(sed -ne 's,.*mmcblk\(.\)boot0.*,\1,g;T;p' /proc/partitions)" if [ -b "/dev/mmcblk${emmc_number}" ] && diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend index d1c54cbe2..bd4224f38 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend @@ -98,11 +98,7 @@ do_install_append_ccimx8x() { } # Disable wireless interfaces on first boot for non-wireless variants -pkg_postinst_${PN}() { - if [ -n "$D" ]; then - exit 1 - fi - +pkg_postinst_ontarget_${PN}() { if [ ! -d "/proc/device-tree/wireless" ]; then sed -i -e '/^auto wlan/{s,^,#,g};/^auto p2p/{s,^,#,g}' /etc/network/interfaces fi