mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
connman: rework network config and init script again
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
# Setup Network
|
||||
# Network configuration
|
||||
|
||||
# Hostname
|
||||
HOSTNAME="openelec"
|
||||
|
||||
# Network type ( wired, wlan, 3g )
|
||||
# Note: only "wired" is still supported
|
||||
NETWORK_TYPE="wired"
|
||||
# Network interface name or address (e.g. "eth0" or "00:0d:56:ec:ba:0c")
|
||||
# you can leave blanc to use eth0
|
||||
IFACE=""
|
||||
|
||||
# Connection type ( dhcp, static )
|
||||
CONNECTION="dhcp"
|
||||
# Static IP address in CIDR format (e.g. "192.168.1.1/24")
|
||||
# leave blanc to use DHCP server
|
||||
IPADDRESS=""
|
||||
|
||||
# IP settings (only with static connection type)
|
||||
# IP address
|
||||
IPADDRESS="192.168.0.12"
|
||||
# Network gateway (e.g. "192.168.1.254")
|
||||
# you must setup if you use an static IP address
|
||||
GATEWAY=""
|
||||
|
||||
# Netmask
|
||||
NETMASK="255.255.255.0"
|
||||
|
||||
# Gateway
|
||||
GATEWAY="192.168.0.1"
|
||||
|
||||
# Nameservers ( auto, ip-address )
|
||||
NAMESERVER1="auto"
|
||||
NAMESERVER2=""
|
||||
NAMESERVER3=""
|
||||
# List of DNS servers (e.g. "192.168.1.253;192.168.1.254")
|
||||
# you must setup if you use an static IP address
|
||||
NAMESERVER=""
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
|
||||
. /etc/profile
|
||||
|
||||
HOSTNAME="openelec" # default hostname
|
||||
NETWORK_TYPE="wired" # default network type
|
||||
CONNECTION="dhcp" # default connection
|
||||
|
||||
[ -f $HOME/.config/network.conf ] && . $HOME/.config/network.conf
|
||||
|
||||
[ -z "$HOSTNAME" ] && HOSTNAME="openelec"
|
||||
[ -z "$IFACE" ] && IFACE=eth0
|
||||
[ -f /sys/class/net/$IFACE/address ] && IFACE=`cat /sys/class/net/$IFACE/address`
|
||||
|
||||
CONNMAN_PROFILE="/var/lib/connman/default.profile"
|
||||
IP=`echo $IPADDRESS | cut -f1 -d/`
|
||||
PREFIX=`echo $IPADDRESS | cut -f2 -d/`
|
||||
|
||||
# bring lo up, whether we have network card or not
|
||||
progress "starting Loopback Network interface"
|
||||
ifconfig lo 127.0.0.1 up
|
||||
@@ -44,20 +48,23 @@ CONNECTION="dhcp" # default connection
|
||||
progress "creating /etc/hosts"
|
||||
echo -e "127.0.0.1\tlocalhost $HOSTNAME" > /etc/hosts
|
||||
|
||||
(
|
||||
# starting Connection manager
|
||||
progress "starting Connection manager"
|
||||
# starting Connection manager
|
||||
progress "starting Connection manager"
|
||||
|
||||
mkdir -p /var/run
|
||||
touch /var/run/resolv.conf
|
||||
[ -x /usr/sbin/connmand ] && /usr/sbin/connmand || exit 0
|
||||
mkdir -p /var/run/connman
|
||||
mkdir -p /var/lib/connman
|
||||
|
||||
usleep 2000
|
||||
echo "[ethernet_`echo $IFACE | sed 's/://g'`_cable]" > $CONNMAN_PROFILE
|
||||
|
||||
if [ "$CONNECTION" = "dhcp" -a -x /usr/bin/cmcc ]; then
|
||||
/usr/bin/cmcc edit Wired ipv4 dhcp
|
||||
elif [ "$CONNECTION" = "static" -a -n "$IPADDRESS" -a -n "$NETMASK" -a -n "$GATEWAY" -a -x /usr/bin/cmcc ]; then
|
||||
/usr/bin/cmcc edit Wired ipv4 manual "$IPADDRESS" "$NETMASK" "$GATEWAY"
|
||||
/usr/bin/cmcc edit Wired nameservers "$NAMESERVER1" "$NAMESERVER2" "$NAMESERVER3"
|
||||
fi
|
||||
)&
|
||||
if [ -z "$IPADDRESS" ]; then
|
||||
echo "IPv4.method=dhcp" >> $CONNMAN_PROFILE
|
||||
else
|
||||
echo "IPv4.method=manual" >> $CONNMAN_PROFILE
|
||||
echo "IPv4.local_address=$IP" >> $CONNMAN_PROFILE
|
||||
[ -n "$PREFIX" ] && echo "IPv4.netmask_prefixlen=$PREFIX" >> $CONNMAN_PROFILE
|
||||
[ -n "$GATEWAY" ] && echo "IPv4.gateway=$GATEWAY" >> $CONNMAN_PROFILE
|
||||
[ -n "$NAMESERVER" ] && echo "Nameservers=$NAMESERVER;" >> $CONNMAN_PROFILE
|
||||
fi
|
||||
|
||||
touch /var/run/resolv.conf
|
||||
/usr/sbin/connmand
|
||||
|
||||
@@ -14,8 +14,5 @@ mkdir -p $INSTALL/usr/lib/connman/plugins
|
||||
mkdir -p $INSTALL/usr/sbin
|
||||
cp -P $PKG_BUILD/src/connmand $INSTALL/usr/sbin
|
||||
|
||||
mkdir -p $INSTALL/usr/bin
|
||||
cp $PKG_DIR/scripts/cmcc $INSTALL/usr/bin
|
||||
|
||||
mkdir -p $INSTALL/usr/config
|
||||
cp $PKG_DIR/config/network.conf $INSTALL/usr/config
|
||||
|
||||
@@ -5,7 +5,7 @@ PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.connman.net"
|
||||
PKG_URL="http://www.kernel.org/pub/linux/network/connman/$PKG_NAME-$PKG_VERSION.tar.bz2"
|
||||
PKG_DEPENDS="glib dbus udev wpa_supplicant Python pygobject dbus-python"
|
||||
PKG_DEPENDS="glib dbus udev wpa_supplicant"
|
||||
PKG_BUILD_DEPENDS="toolchain glib dbus udev"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="network"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
https://code.launchpad.net/~indicator-network-developers/indicator-network/indicator-network
|
||||
Reference in New Issue
Block a user