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 <javier.viguera@digi.com>
This commit is contained in:
Stephan Klatt 2016-06-17 12:00:42 +02:00 committed by Javier Viguera
parent 6746254558
commit b31c09e59f
1 changed files with 12 additions and 11 deletions

View File

@ -46,37 +46,38 @@ do_install_append() {
# Cellular interface # Cellular interface
if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then
cat ${WORKDIR}/interfaces.cellular >> ${D}${sysconfdir}/network/interfaces 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 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 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 else
sed -i -e '/apn/d' ${D}${sysconfdir}/network/interfaces sed -i -e '/^\s*apn/d' ${D}${sysconfdir}/network/interfaces
fi fi
if [ -n "${CELLULAR_PIN}" ]; then 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 else
sed -i -e '/pin/d' ${D}${sysconfdir}/network/interfaces sed -i -e '/^\s*pin/d' ${D}${sysconfdir}/network/interfaces
fi fi
if [ -n "${CELLULAR_PORT}" ]; then 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 sed -i -e 's,dhcp,manual,g' ${D}${sysconfdir}/network/interfaces
else else
sed -i -e '/port/d' ${D}${sysconfdir}/network/interfaces sed -i -e '/^\s*port/d' ${D}${sysconfdir}/network/interfaces
fi fi
if [ -n "${CELLULAR_USER}" ]; then 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 else
sed -i -e '/user/d' ${D}${sysconfdir}/network/interfaces sed -i -e '/^\s*user/d' ${D}${sysconfdir}/network/interfaces
fi fi
if [ -n "${CELLULAR_PASSWORD}" ]; then 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 else
sed -i -e '/password/d' ${D}${sysconfdir}/network/interfaces sed -i -e '/^\s*password/d' ${D}${sysconfdir}/network/interfaces
fi fi
fi fi