Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Use NetworkManager #241

Merged
merged 4 commits into from
Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions conf/local.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ RDEPENDS_packagegroup-core-full-cmdline-sys-services_remove=" nfs-utils at tcp-w
PACKAGE_EXCLUDE+=" ed"
RDEPENDS_packagegroup-core-full-cmdline-utils_remove = " ed"

PACKAGE_EXCLUDE+=" wireless-tools"
RDEPENDS_packagegroup-base-wifi_remove = " wireless-tools"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These PACKAGE_EXCLUDE, RDEPENDS_packagegroup-xyz should be moved to the images bb files. RDEPENDS_packagegroup_xyz lines remain the same, PACKAGE_EXCLUDE lines becomes IMAGE_INSTALL_remove.

PACKAGE_EXCLUDE+=" libacpi libnss-mdns"
RDEPENDS_packagegroup-base-acpi_remove = " libacpi"
RDEPENDS_packagegroup-base-zeroconf_remove = " libnss-mdns"
Expand Down
1 change: 1 addition & 0 deletions recipes-connectivity/modemmanager/modemmanager_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RDEPENDS_${PN} += "glibc-gconv-utf-16"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

[keyfile]
unmanaged-devices=interface-name:usb0
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

FILECONDITION="/etc/sysconfig/networkmanager"
WIFI_AP_DEFAULTPASSWORD="1234567890"

# This is the APN name for AT&T HSPA+, user should change this with:
# nmcli con modify Modem gsm.apn <name>
MODEM_APN_NAME="phone"

while [ 1 ]; do
read xx MAC xx <<<$(ip link | grep -A1 -e "^[0-9]*: wl" | grep link/ether)
# poor's man "wait for device to appear"
if [ -z "$MAC" ]; then
sleep 1
continue
fi

# remove :
SSID=${MAC//:}
# make it uppercase
SSID=${SSID^^}
# prefix "Aero-"
SSID="Aero-$SSID"
break
done

# Let NetworkManager start dnsmasq with the right configuration file
systemctl disable dnsmasq
systemctl stop dnsmasq
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a bbappend on dnsmasq recipe to not enable it.


# SystemD is creating this file as symbolic link and taking care of if, not
# letting netowrkmanager update it with dns from modem of wifi client mode.
rm /etc/resolv.conf

# Wifi
nmcli con add type wifi ifname '*' con-name Wifi-hostspot autoconnect yes ssid $SSID
nmcli con modify Wifi-hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Wifi-hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Wifi-hostspot wifi-sec.psk "$WIFI_AP_DEFAULTPASSWORD"
nmcli con modify Wifi-hostspot ipv4.addresses 192.168.8.1/24
nmcli con up Wifi-hostspot

# Modem
nmcli con add type gsm ifname '*' con-name Modem apn $MODEM_APN_NAME autoconnect yes
nmcli con up Modem

# Make sure this script just run once
mkdir -p $(dirname $FILECONDITION)
touch $FILECONDITION
echo "First boot configuration succesful"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=NetworkManager service default configuration
Requisite=NetworkManager.service
After=NetworkManager.service
Before=network.target multi-user.target
Wants=network.target
ConditionPathExists=!/etc/sysconfig/networkmanager

[Service]
Type=oneshot
ExecStart=/usr/sbin/firstboot-networkmanager-setup

[Install]
WantedBy=multi-user.target
20 changes: 20 additions & 0 deletions recipes-connectivity/networkmanager/networkmanager_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://firstboot-networkmanager.service"
SRC_URI += "file://firstboot-networkmanager-setup"
SRC_URI += "file://NetworkManager.conf"

PACKAGECONFIG += "modemmanager"
PACKAGECONFIG += "ppp"
PACKAGECONFIG += "wifi"
PACKAGECONFIG += "systemd"

DEPENDS += "nss"

SYSTEMD_SERVICE_${PN} += "firstboot-networkmanager.service"

do_install_append() {
install -D -m 0755 ${WORKDIR}/firstboot-networkmanager-setup ${D}/usr/sbin
install -D -m 0644 ${WORKDIR}/firstboot-networkmanager.service ${D}${systemd_unitdir}/system
install -D -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager
}
5 changes: 4 additions & 1 deletion recipes-core/images/intel-aero-image.bb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ IMAGE_INSTALL += "librealsense"
IMAGE_INSTALL += "librealsense-graphical-examples"

# connectivity
IMAGE_INSTALL += "connman connman-client"
IMAGE_INSTALL += "modemmanager"
IMAGE_INSTALL += "networkmanager"
IMAGE_INSTALL += "ppp"
IMAGE_INSTALL += "resolvconf"
IMAGE_INSTALL += "openssh-sftp-server"

IMAGE_INSTALL += "hostapd"
Expand Down