sumo migration: use pkg_postinst_ontarget() to delayed operation on first boot

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2018-12-17 17:48:23 +01:00
parent ee8c67ea66
commit 303106cce1
8 changed files with 11 additions and 25 deletions

View File

@ -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

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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"

View File

@ -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}" ] &&

View File

@ -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