init-ifupdown: generalize do_install and files
This commit: - moves the files in platform folders 'ccimx6qsbc' and 'ccimx6ul' to the recipe's folder (they are the same). - moves the install instructions for virtual wlan and wlan1 into functions that can be reused by both platforms. - moves the bridge example install instruction to the generic do_install() since it's the same for all. Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
parent
f2388f1cb7
commit
dc51962fb0
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
## Example bridge between eth0 and wlan1
|
||||
#auto br0
|
||||
#iface br0 inet static
|
||||
# bridge_ports eth0 wlan1
|
||||
# address 192.168.42.50
|
||||
# netmask 255.255.255.0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
auto wlan1
|
||||
iface wlan1 inet dhcp
|
||||
udhcpc_opts -S -b >/dev/null &
|
||||
post-up /etc/init.d/hostapd start
|
||||
pre-down /etc/init.d/hostapd stop
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
auto wlan1
|
||||
iface wlan1 inet static
|
||||
address ##WLAN1_STATIC_IP##
|
||||
netmask ##WLAN1_STATIC_NETMASK##
|
||||
gateway ##WLAN1_STATIC_GATEWAY##
|
||||
dns-nameservers ##WLAN1_STATIC_DNS##
|
||||
post-up /etc/init.d/hostapd start
|
||||
pre-down /etc/init.d/hostapd stop
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2017, Digi International Inc.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
# This will create a second wireless network device
|
||||
if [ -s "/proc/device-tree/wireless/mac-address1" ] &&
|
||||
[ -s "/proc/device-tree/wireless/mac-address2" ] &&
|
||||
[ -s "/proc/device-tree/wireless/mac-address3" ]; then
|
||||
:
|
||||
else
|
||||
echo "[WARN] Using default MAC addresses for virtual interfaces, please program them referring to the Digi U-Boot Documentation"
|
||||
fi
|
||||
|
||||
if [ ! -d "/sys/class/net/wlan1" ]; then
|
||||
# This will create a second wireless network device
|
||||
iw dev wlan0 interface add wlan1 type __ap
|
||||
fi
|
||||
|
|
@ -49,54 +49,41 @@ do_install_append() {
|
|||
sed -i -e "s,##P2P0_STATIC_GATEWAY##,${P2P0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##P2P0_STATIC_DNS##,${P2P0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WPA_DRIVER##,${WPA_DRIVER},g" ${D}${sysconfdir}/network/interfaces
|
||||
|
||||
cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces
|
||||
}
|
||||
|
||||
do_install_append_ccimx6sbc() {
|
||||
cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces
|
||||
install_virtwlans() {
|
||||
install -d ${D}${base_bindir}
|
||||
install -m 0755 ${WORKDIR}/virtwlans.sh ${D}${base_bindir}
|
||||
}
|
||||
|
||||
install_wlan1() {
|
||||
if [ -n "${HAVE_WIFI}" ]; then
|
||||
cat ${WORKDIR}/interfaces.wlan1.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces
|
||||
fi
|
||||
|
||||
# Remove config entries if corresponding variable is not defined
|
||||
[ -z "${WLAN1_STATIC_DNS}" ] && sed -i -e "/##WLAN1_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN1_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_IP}" ] && sed -i -e "/##WLAN1_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_NETMASK}" ] && sed -i -e "/##WLAN1_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces
|
||||
|
||||
# Replace interface parameters
|
||||
sed -i -e "s,##WLAN1_STATIC_IP##,${WLAN1_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_NETMASK##,${WLAN1_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_GATEWAY##,${WLAN1_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_DNS##,${WLAN1_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces
|
||||
}
|
||||
|
||||
do_install_append_ccimx6qpsbc() {
|
||||
install -d ${D}${base_bindir}
|
||||
install -m 0755 ${WORKDIR}/virtwlans.sh ${D}${base_bindir}
|
||||
if [ -n "${HAVE_WIFI}" ]; then
|
||||
cat ${WORKDIR}/interfaces.wlan1.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces
|
||||
fi
|
||||
|
||||
# Remove config entries if corresponding variable is not defined
|
||||
[ -z "${WLAN1_STATIC_DNS}" ] && sed -i -e "/##WLAN1_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN1_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_IP}" ] && sed -i -e "/##WLAN1_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_NETMASK}" ] && sed -i -e "/##WLAN1_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces
|
||||
|
||||
# Replace interface parameters
|
||||
sed -i -e "s,##WLAN1_STATIC_IP##,${WLAN1_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_NETMASK##,${WLAN1_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_GATEWAY##,${WLAN1_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_DNS##,${WLAN1_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces
|
||||
|
||||
cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces
|
||||
install_virtwlans
|
||||
install_wlan1
|
||||
}
|
||||
|
||||
do_install_append_ccimx6ul() {
|
||||
install -d ${D}${base_bindir}
|
||||
install -m 0755 ${WORKDIR}/virtwlans.sh ${D}${base_bindir}
|
||||
if [ -n "${HAVE_WIFI}" ]; then
|
||||
cat ${WORKDIR}/interfaces.wlan1.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces
|
||||
fi
|
||||
|
||||
# Remove config entries if corresponding variable is not defined
|
||||
[ -z "${WLAN1_STATIC_DNS}" ] && sed -i -e "/##WLAN1_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN1_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_IP}" ] && sed -i -e "/##WLAN1_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces
|
||||
[ -z "${WLAN1_STATIC_NETMASK}" ] && sed -i -e "/##WLAN1_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces
|
||||
|
||||
# Replace interface parameters
|
||||
sed -i -e "s,##WLAN1_STATIC_IP##,${WLAN1_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_NETMASK##,${WLAN1_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_GATEWAY##,${WLAN1_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces
|
||||
sed -i -e "s,##WLAN1_STATIC_DNS##,${WLAN1_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces
|
||||
|
||||
cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces
|
||||
install_virtwlans
|
||||
install_wlan1
|
||||
}
|
||||
|
||||
# Disable wireless interfaces on first boot for non-wireless variants
|
||||
|
|
|
|||
Loading…
Reference in New Issue