From b31c09e59f7b4d14eaadcce17be45b48b136b437 Mon Sep 17 00:00:00 2001 From: Stephan Klatt Date: Fri, 17 Jun 2016 12:00:42 +0200 Subject: [PATCH] init-ifupdown: misc cellular fixes * set cellular user and password * stricter replace to not match set values * only set cellular interface to auto Internal merge of Github's PR: https://github.com/digi-embedded/meta-digi/pull/2 Signed-off-by: Javier Viguera --- .../init-ifupdown/init-ifupdown_1.0.bbappend | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) 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 ff4378aa5..1cde43cfc 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 @@ -46,37 +46,38 @@ do_install_append() { # Cellular interface if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then cat ${WORKDIR}/interfaces.cellular >> ${D}${sysconfdir}/network/interfaces + [ -n "${CELLULAR_AUTO}" ] && sed -i -e 's/^#auto ##CELLULAR_INTERFACE##/auto ##CELLULAR_INTERFACE##/g' ${D}${sysconfdir}/network/interfaces sed -i -e 's,##CELLULAR_INTERFACE##,${CELLULAR_INTERFACE},g' ${D}${sysconfdir}/network/interfaces - [ -n "${CELLULAR_AUTO}" ] && sed -i -e 's/#auto/auto/g' ${D}${sysconfdir}/network/interfaces + if [ -n "${CELLULAR_APN}" ]; then - sed -i -e 's/apn/apn ${CELLULAR_APN}/g' ${D}${sysconfdir}/network/interfaces + sed -i -e 's/^\(\s*\)apn/\1apn ${CELLULAR_APN}/g' ${D}${sysconfdir}/network/interfaces else - sed -i -e '/apn/d' ${D}${sysconfdir}/network/interfaces + sed -i -e '/^\s*apn/d' ${D}${sysconfdir}/network/interfaces fi if [ -n "${CELLULAR_PIN}" ]; then - sed -i -e 's/pin/pin ${CELLULAR_PIN}/g' ${D}${sysconfdir}/network/interfaces + sed -i -e 's/^\(\s*\)pin/\1pin ${CELLULAR_PIN}/g' ${D}${sysconfdir}/network/interfaces else - sed -i -e '/pin/d' ${D}${sysconfdir}/network/interfaces + sed -i -e '/^\s*pin/d' ${D}${sysconfdir}/network/interfaces fi if [ -n "${CELLULAR_PORT}" ]; then - sed -i -e 's/port/port ${CELLULAR_PORT}/g' ${D}${sysconfdir}/network/interfaces + sed -i -e 's/^\(\s*\)port/\1port ${CELLULAR_PORT}/g' ${D}${sysconfdir}/network/interfaces sed -i -e 's,dhcp,manual,g' ${D}${sysconfdir}/network/interfaces else - sed -i -e '/port/d' ${D}${sysconfdir}/network/interfaces + sed -i -e '/^\s*port/d' ${D}${sysconfdir}/network/interfaces fi if [ -n "${CELLULAR_USER}" ]; then - sed -i -e 's/user/user ${CELLULAR_PORT}/g' ${D}${sysconfdir}/network/interfaces + sed -i -e 's/^\(\s*\)user/\1user ${CELLULAR_USER}/g' ${D}${sysconfdir}/network/interfaces else - sed -i -e '/user/d' ${D}${sysconfdir}/network/interfaces + sed -i -e '/^\s*user/d' ${D}${sysconfdir}/network/interfaces fi if [ -n "${CELLULAR_PASSWORD}" ]; then - sed -i -e 's/password/password ${CELLULAR_PORT}/g' ${D}${sysconfdir}/network/interfaces + sed -i -e 's/^\(\s*\)password/\1password ${CELLULAR_PASSWORD}/g' ${D}${sysconfdir}/network/interfaces else - sed -i -e '/password/d' ${D}${sysconfdir}/network/interfaces + sed -i -e '/^\s*password/d' ${D}${sysconfdir}/network/interfaces fi fi