first commit
This commit is contained in:
		
							
								
								
									
										6
									
								
								etc_org/NetworkManager/NetworkManager.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								etc_org/NetworkManager/NetworkManager.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
[main]
 | 
			
		||||
plugins=ifupdown,keyfile,ofono
 | 
			
		||||
dns=dnsmasq
 | 
			
		||||
 | 
			
		||||
[ifupdown]
 | 
			
		||||
managed=false
 | 
			
		||||
							
								
								
									
										13
									
								
								etc_org/NetworkManager/VPN/nm-pptp-service.name
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								etc_org/NetworkManager/VPN/nm-pptp-service.name
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
[VPN Connection]
 | 
			
		||||
name=pptp
 | 
			
		||||
service=org.freedesktop.NetworkManager.pptp
 | 
			
		||||
program=/usr/lib/NetworkManager/nm-pptp-service
 | 
			
		||||
supports-multiple-connections=true
 | 
			
		||||
 | 
			
		||||
[libnm]
 | 
			
		||||
plugin=/usr/lib/arm-linux-gnueabihf/NetworkManager/libnm-vpn-plugin-pptp.so
 | 
			
		||||
 | 
			
		||||
[GNOME]
 | 
			
		||||
auth-dialog=/usr/lib/NetworkManager/nm-pptp-auth-dialog
 | 
			
		||||
properties=/usr/lib/arm-linux-gnueabihf/NetworkManager/libnm-pptp-properties
 | 
			
		||||
supports-external-ui-mode=true
 | 
			
		||||
@@ -0,0 +1,2 @@
 | 
			
		||||
[connection]
 | 
			
		||||
wifi.powersave = 3
 | 
			
		||||
							
								
								
									
										76
									
								
								etc_org/NetworkManager/dispatcher.d/01ifupdown
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										76
									
								
								etc_org/NetworkManager/dispatcher.d/01ifupdown
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,76 @@
 | 
			
		||||
#!/bin/sh -e
 | 
			
		||||
# Script to dispatch NetworkManager events
 | 
			
		||||
#
 | 
			
		||||
# Runs ifupdown scripts when NetworkManager fiddles with interfaces.
 | 
			
		||||
# See NetworkManager(8) for further documentation of the dispatcher events.
 | 
			
		||||
 | 
			
		||||
if [ -z "$1" ]; then
 | 
			
		||||
    echo "$0: called with no interface" 1>&2
 | 
			
		||||
    exit 1;
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -n "$IP4_NUM_ADDRESSES" ] && [ "$IP4_NUM_ADDRESSES" -gt 0 ]; then
 | 
			
		||||
   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet"
 | 
			
		||||
fi
 | 
			
		||||
if [ -n "$IP6_NUM_ADDRESSES" ] && [ "$IP6_NUM_ADDRESSES" -gt 0 ]; then
 | 
			
		||||
   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet6"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# If we have a VPN connection ignore the underlying IP address(es)
 | 
			
		||||
if [ "$2" = "vpn-up" ] || [ "$2" = "vpn-down" ]; then
 | 
			
		||||
   ADDRESS_FAMILIES=""
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -n "$VPN_IP4_NUM_ADDRESSES" ] && [ "$VPN_IP4_NUM_ADDRESSES" -gt 0 ]; then
 | 
			
		||||
   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet"
 | 
			
		||||
fi
 | 
			
		||||
if [ -n "$VPN_IP6_NUM_ADDRESSES" ] && [ "$VPN_IP6_NUM_ADDRESSES" -gt 0 ]; then
 | 
			
		||||
   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet6"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# We're probably bringing the interface down.
 | 
			
		||||
[ -n "$ADDRESS_FAMILIES" ] || ADDRESS_FAMILIES="inet"
 | 
			
		||||
 | 
			
		||||
# Fake ifupdown environment
 | 
			
		||||
export IFACE="$1"
 | 
			
		||||
export LOGICAL="$1"
 | 
			
		||||
export METHOD="NetworkManager"
 | 
			
		||||
export VERBOSITY="0"
 | 
			
		||||
 | 
			
		||||
for i in $ADDRESS_FAMILIES; do
 | 
			
		||||
 | 
			
		||||
    export ADDRFAM="$i"
 | 
			
		||||
 | 
			
		||||
    # Run the right scripts
 | 
			
		||||
    case "$2" in
 | 
			
		||||
        up|vpn-up)
 | 
			
		||||
            export MODE="start"
 | 
			
		||||
            export PHASE="post-up"
 | 
			
		||||
            run-parts /etc/network/if-up.d
 | 
			
		||||
            ;;
 | 
			
		||||
        down|vpn-down)
 | 
			
		||||
            export MODE="stop"
 | 
			
		||||
            export PHASE="post-down"
 | 
			
		||||
            run-parts /etc/network/if-post-down.d
 | 
			
		||||
            ;;
 | 
			
		||||
# pre-up/pre-down not implemented. See
 | 
			
		||||
# https://bugzilla.gnome.org/show_bug.cgi?id=387832
 | 
			
		||||
#        pre-up)
 | 
			
		||||
#            export MODE="start"
 | 
			
		||||
#            export PHASE="pre-up"
 | 
			
		||||
#            run-parts /etc/network/if-pre-up.d
 | 
			
		||||
#            ;;
 | 
			
		||||
#        pre-down)
 | 
			
		||||
#            export MODE="stop"
 | 
			
		||||
#            export PHASE="pre-down"
 | 
			
		||||
#            run-parts /etc/network/if-down.d
 | 
			
		||||
#            ;;
 | 
			
		||||
        hostname|dhcp4-change|dhcp6-change)
 | 
			
		||||
            # Do nothing
 | 
			
		||||
            ;;
 | 
			
		||||
        *)
 | 
			
		||||
            echo "$0: called with unknown action \`$2'" 1>&2
 | 
			
		||||
            exit 1
 | 
			
		||||
            ;;
 | 
			
		||||
    esac
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										119
									
								
								etc_org/NetworkManager/dispatcher.d/99tlp-rdw-nm
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										119
									
								
								etc_org/NetworkManager/dispatcher.d/99tlp-rdw-nm
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
# tlp-rdw - network manager dispatcher hook:
 | 
			
		||||
#           enable/disable radios on ifup/ifdown
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2015 Thomas Koch <linrunner at gmx.net>
 | 
			
		||||
# This software is licensed under the GPL v2 or later.
 | 
			
		||||
 | 
			
		||||
# --- Constants
 | 
			
		||||
readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm"
 | 
			
		||||
readonly LIBS="tlp-functions tlp-rf-func"
 | 
			
		||||
 | 
			
		||||
readonly RDW_NM_LOCK="rdw_nm"
 | 
			
		||||
readonly RDW_NM_LOCKTIME=2
 | 
			
		||||
 | 
			
		||||
# --- Locate and source libraries
 | 
			
		||||
for libdir in $LIBDIRS; do [ -d $libdir ] && break; done
 | 
			
		||||
[ -d $libdir ] || exit 0
 | 
			
		||||
 | 
			
		||||
for lib in $LIBS; do
 | 
			
		||||
    [ -f $libdir/$lib ] || exit 0
 | 
			
		||||
    . $libdir/$lib
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# --- MAIN
 | 
			
		||||
read_defaults
 | 
			
		||||
check_tlp_enabled || exit 0
 | 
			
		||||
add_sbin2path
 | 
			
		||||
 | 
			
		||||
# Get args
 | 
			
		||||
iface="$1"
 | 
			
		||||
action="$2"
 | 
			
		||||
itype="unknown"
 | 
			
		||||
 | 
			
		||||
# Quit for invalid interfaces
 | 
			
		||||
[ -n "$iface" ] && [ "$iface" != "none" ] || exit 0
 | 
			
		||||
 | 
			
		||||
echo_debug "nm" "rdw_nm($iface).$action"
 | 
			
		||||
if [ -n "$addpath" ]; then
 | 
			
		||||
    echo_debug "path" "PATH=$oldpath[$addpath]"
 | 
			
		||||
else
 | 
			
		||||
    echo_debug "path" "PATH=$oldpath"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Quit if timed lock in progress
 | 
			
		||||
check_timed_lock $RDW_NM_LOCK && exit 0
 | 
			
		||||
 | 
			
		||||
# Determine interface type
 | 
			
		||||
if cmd_exists $NMCLI ; then
 | 
			
		||||
    # nmcli is available --> check if nmcli dev output matches interface
 | 
			
		||||
    itype="$($NMCLI dev | awk '$1 ~ /'$iface'/ { print $2; }')"
 | 
			
		||||
 | 
			
		||||
    if [ -z "$itype" ]; then
 | 
			
		||||
        # iface is not found in nmcli dev output: many WWAN devices have
 | 
			
		||||
        # different devices for control and the actual network connection
 | 
			
		||||
        # --> check if interface matches a WWAN device
 | 
			
		||||
        get_wwan_ifaces
 | 
			
		||||
        if wordinlist "$iface" "$wanifaces"; then
 | 
			
		||||
            itype="wwan"
 | 
			
		||||
        else
 | 
			
		||||
            itype="unknown"
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
    echo_debug "nm" "rdw_nm($iface).$action: type=$itype [nmcli]"
 | 
			
		||||
else
 | 
			
		||||
    # nmcli is not available
 | 
			
		||||
    echo_debug "nm" "rdw_nm($iface)$action.nmcli_not_available"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case $action in
 | 
			
		||||
    up) # interface up, disable configured interfaces
 | 
			
		||||
 | 
			
		||||
        set_timed_lock $RDW_NM_LOCK $RDW_NM_LOCKTIME # lock rdw events
 | 
			
		||||
 | 
			
		||||
        case $itype in
 | 
			
		||||
            *ethernet)
 | 
			
		||||
                for dev in $DEVICES_TO_DISABLE_ON_LAN_CONNECT; do
 | 
			
		||||
                    [ -n "$dev" ] && device_switch $dev off
 | 
			
		||||
                done
 | 
			
		||||
                ;;
 | 
			
		||||
 | 
			
		||||
            *wireless|wifi)
 | 
			
		||||
                for dev in $DEVICES_TO_DISABLE_ON_WIFI_CONNECT; do
 | 
			
		||||
                    [ -n "$dev" ] && [ "$dev" != wifi ] && device_switch $dev off
 | 
			
		||||
                done
 | 
			
		||||
                ;;
 | 
			
		||||
 | 
			
		||||
            gsm|wwan)
 | 
			
		||||
                for dev in $DEVICES_TO_DISABLE_ON_WWAN_CONNECT; do
 | 
			
		||||
                    [ -n "$dev" ] && [ "$dev" != wwan ] && device_switch $dev off
 | 
			
		||||
                done
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
        ;; # up
 | 
			
		||||
 | 
			
		||||
    down) # interface down, enable configured interfaces
 | 
			
		||||
        case $itype in
 | 
			
		||||
            *ethernet)
 | 
			
		||||
                for dev in $DEVICES_TO_ENABLE_ON_LAN_DISCONNECT; do
 | 
			
		||||
                    [ -n "$dev" ] && device_switch $dev on
 | 
			
		||||
                done
 | 
			
		||||
                ;;
 | 
			
		||||
 | 
			
		||||
            *wireless|wifi)
 | 
			
		||||
                for dev in $DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT; do
 | 
			
		||||
                    [ -n "$dev" ] && [ "$dev" != wifi ] && device_switch $dev on
 | 
			
		||||
                done
 | 
			
		||||
                ;;
 | 
			
		||||
 | 
			
		||||
            gsm)
 | 
			
		||||
                for dev in $DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT; do
 | 
			
		||||
                    [ -n "$dev" ] && [ "$dev" != wwan ] && device_switch $dev on
 | 
			
		||||
                done
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
        ;; # down
 | 
			
		||||
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
		Reference in New Issue
	
	Block a user