connman: rework systemd service files, connman-vpn will be started byself, set loopback device early, create default config on first startup if not exist

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-08-17 22:04:36 +02:00
parent 204c71ec6a
commit 36781c02bc
5 changed files with 23 additions and 20 deletions

View File

@ -94,6 +94,9 @@ post_makeinstall_target() {
cp -P client/connmanctl $INSTALL/usr/bin
cp -P $PKG_DIR/scripts/cm-online $INSTALL/usr/bin
mkdir -p $INSTALL/usr/lib/connman
cp -P $PKG_DIR/scripts/connman-setup $INSTALL/usr/lib/connman
mkdir -p $INSTALL/etc
ln -sf /var/cache/resolv.conf $INSTALL/etc/resolv.conf
@ -120,8 +123,6 @@ post_install() {
post_install() {
enable_service hostname.service
enable_service loopback.service
enable_service connman.service
if [ "$PPTP_SUPPORT" = yes -o "$OPENVPN_SUPPORT" = yes ]; then
enable_service connman-vpn.service
fi
}

View File

@ -1,3 +1,4 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
@ -18,19 +19,8 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
wait_for_inet_addr () {
if [ -f $CONFIG_CACHE/openelec/network_wait ]; then
. $CONFIG_CACHE/openelec/network_wait
# creating initial settings file
if [ ! -f /storage/.cache/connman/settings ]; then
mkdir -p /storage/.cache/connman
cp /usr/share/connman/settings /storage/.cache/connman
fi
if [ "$WAIT_NETWORK" = "true" -o "$1" == "force" ] ; then
progress "Wait for network"
[ -z "$WAIT_NETWORK_TIME" ] && WAIT_NETWORK_TIME=10
LOOP_COUNT=$((WAIT_NETWORK_TIME * 5))
for i in $(seq 1 $LOOP_COUNT) ; do
cnt=$(ifconfig | sed -e '/inet addr:/!d' -e '/127.0.0.1/d' |wc -l)
[ $cnt -gt 0 ] && break
usleep 200000
done
fi
}

View File

@ -1,7 +1,6 @@
[Unit]
Description=ConnMan VPN service
Before=network.target
Wants=network.target
After=syslog.target
[Service]
Type=dbus

View File

@ -7,6 +7,7 @@ Wants=network.target
Type=dbus
BusName=net.connman
Restart=on-failure
ExecStartPre=/usr/lib/connman/connman-setup
ExecStart=/usr/sbin/connmand -n
StandardOutput=null

View File

@ -0,0 +1,12 @@
[Unit]
Description=Setup Loopback interface
DefaultDependencies=no
[Service]
Type=oneshot
ExecStartPre=/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0
ExecStart=/sbin/ifconfig lo up
RemainAfterExit=yes
[Install]
WantedBy=sysinit.target