saving uncommitted changes in /etc prior to emerge run

This commit is contained in:
hasufell 2015-03-18 10:58:42 +01:00 committed by root
parent 6c5f534d61
commit 973b9bab89
13 changed files with 264 additions and 5 deletions

View File

@ -0,0 +1,6 @@
[main]
plugins=ifnet,keyfile
[ifnet]
managed=true
auto_refresh=false

View File

@ -0,0 +1,35 @@
#!/bin/sh
# Copyright (c) 2012 Alexandre Rostovtsev
# Released under the 2-clause BSD license.
# Ensures that the NetworkManager OpenRC service is marked as started and
# providing net only when it has a successful connection.
if [ ! -e "/run/openrc/softlevel" ]; then
# OpenRC is not running
exit 0
fi
# Ensure rc-service is in PATH
PATH="${PATH}:/sbin:/usr/sbin"
# Exit if the NetworkManager OpenRC service is not running
rc-service NetworkManager status 2>&1 | grep -Eq "status: (starting|started|inactive|stopping)" || exit 0
# Call rc-service in background mode so that the start/stop functions update
# NetworkManager service status to started or inactive instead of actually
# starting or stopping the daemon
export IN_BACKGROUND=YES
case "$2" in
up) nm-online -t 0 -x &&
! rc-service NetworkManager status 2>&1 | grep -q started &&
exec rc-service NetworkManager start ;;
down) nm-online -t 0 -x ||
rc-service NetworkManager status 2>&1 | grep -q stopped ||
exec rc-service NetworkManager stop ;;
pre-sleep) rc-service NetworkManager status 2>&1 | grep -q stopped ||
exec rc-service NetworkManager stop ;;
esac
exit 0
# vim: set ts=4:

4
conf.d/NetworkManager Normal file
View File

@ -0,0 +1,4 @@
# If NetworkManager does not establish a connection within $INACTIVE_TIMEOUT
# seconds after starting, the service will be marked as inactive, and it will
# continue to wait for a connection in background mode.
INACTIVE_TIMEOUT=1

View File

@ -2,8 +2,8 @@
# scripts in /etc/init.d. To create a more complete configuration,
# please review /usr/share/doc/openrc/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#config_eth1="192.168.0.12 netmask 255.255.255.0 brd 192.168.0.255"
#routes_eth1="default via 192.168.0.1"
config_eth1="192.168.0.12 netmask 255.255.255.0 brd 192.168.0.255"
routes_eth1="default via 192.168.0.1"
#routes_eth0="default via 192.168.0.1
#10.0.0.0/8 via 192.168.0.1
#::/0"

View File

@ -0,0 +1,13 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.freedesktop.nm_avahi_autoipd"/>
</policy>
<policy context="default">
<deny own="org.freedesktop.nm_avahi_autoipd"/>
<deny send_destination="org.freedesktop.nm_avahi_autoipd"/>
</policy>
</busconfig>

View File

@ -0,0 +1,13 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.freedesktop.nm_dhcp_client"/>
</policy>
<policy context="default">
<deny own="org.freedesktop.nm_dhcp_client"/>
<deny send_destination="org.freedesktop.nm_dhcp_client"/>
</policy>
</busconfig>

View File

@ -0,0 +1,14 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.freedesktop.nm_dispatcher"/>
<allow send_destination="org.freedesktop.nm_dispatcher"/>
</policy>
<policy context="default">
<deny own="org.freedesktop.nm_dispatcher"/>
<deny send_destination="org.freedesktop.nm_dispatcher"/>
</policy>
</busconfig>

View File

@ -0,0 +1,117 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.freedesktop.NetworkManager"/>
<allow send_destination="org.freedesktop.NetworkManager"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.PPP"/>
<allow send_interface="org.freedesktop.NetworkManager.SecretAgent"/>
<!-- Allow NM to talk to known VPN plugins; due to a bug in
the D-Bus daemon, when a plugin is installed and the user
immediately tries to use it, the VPN plugin's rules aren't
always loaded into dbus-daemon. Those rules allow NM to
talk to the plugin. Oops. Work around that by explicitly
allowing NM to talk to VPN plugins here.
-->
<allow send_destination="org.freedesktop.NetworkManager.openconnect"/>
<allow send_destination="org.freedesktop.NetworkManager.openswan"/>
<allow send_destination="org.freedesktop.NetworkManager.openvpn"/>
<allow send_destination="org.freedesktop.NetworkManager.pptp"/>
<allow send_destination="org.freedesktop.NetworkManager.vpnc"/>
<allow send_destination="org.freedesktop.NetworkManager.ssh"/>
</policy>
<policy at_console="true">
<allow send_destination="org.freedesktop.NetworkManager"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.DBus.Properties"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.AccessPoint"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Connection.Active"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Device.Modem"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Device.Wired"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Device.Serial"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Device.Wireless"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Device"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.DHCP4Config"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.IP4Config"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.VPN.Connection"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.AgentManager"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="SetLogging"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="Sleep"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="sleep"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="wake"/>
</policy>
<policy context="default">
<deny own="org.freedesktop.NetworkManager"/>
<deny send_destination="org.freedesktop.NetworkManager"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.Settings"/>
<allow send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager.AgentManager"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="SetLogging"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="Sleep"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="sleep"/>
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="wake"/>
</policy>
</busconfig>

57
init.d/NetworkManager Executable file
View File

@ -0,0 +1,57 @@
#!/sbin/runscript
# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
# Distributed under the terms of the GNU General Purpose License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/init.d.NetworkManager,v 1.1 2013/01/28 07:05:05 tetromino Exp $
description="NetworkManager daemon. The service is marked as started only \
when a network connection is established."
depend() {
need dbus
provide net
}
start() {
# If we are re-called by a dispatcher event, we want to mark the service
# as started without starting the daemon again
yesno "${IN_BACKGROUND}" && return 0
[ -z "${INACTIVE_TIMEOUT}" ] && INACTIVE_TIMEOUT="1"
ebegin "Starting NetworkManager"
start-stop-daemon --start --quiet --pidfile /run/NetworkManager/NetworkManager.pid \
--exec /usr/sbin/NetworkManager -- --pid-file /run/NetworkManager/NetworkManager.pid
local _retval=$?
eend "${_retval}"
if [ "x${_retval}" = 'x0' ] && ! nm-online -t "${INACTIVE_TIMEOUT}"; then
einfo "Marking NetworkManager as inactive. It will automatically be marked"
einfo "as started after a network connection has been established."
mark_service_inactive
fi
return "${_retval}"
}
stop() {
# If we are re-called by a dispatcher event, we want to mark the service
# as inactive without stopping the daemon
if yesno "${IN_BACKGROUND}"; then
mark_service_inactive "${SVCNAME}"
return 0
fi
ebegin "Stopping NetworkManager"
local pidfile=/run/NetworkManager/NetworkManager.pid
if [ ! -e "${pidfile}" ] && [ -e /var/run/NetworkManager.pid ]; then
# Try stopping the pid file used by <0.9.7
pidfile=/var/run/NetworkManager.pid
start-stop-daemon --stop --quiet --pidfile "${pidfile}"
ret=$?
[ ${ret} = 0 ] && [ -e "${pidfile}" ] && rm "${pidfile}"
eend ${ret}
else
start-stop-daemon --stop --quiet --pidfile "${pidfile}"
eend $?
fi
}
# vim: set ft=gentoo-init-d ts=4 :

View File

@ -1,7 +1,7 @@
# Generated by dhcpcd
# Generated by dhcpcd from eth1, eth1:dhcp6, eth1:ra
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line
nameserver 192.168.0.1
nameserver 192.168.0.2
nameserver 2a02:908:2:1108::11
nameserver 2a02:908:2:1107::11
# /etc/resolv.conf.tail can replace this line

View File

@ -29,7 +29,7 @@ SocksPort 9050 # Default: Bind to localhost:9050 for local connections.
## can access your SocksPort may be able to learn about the connections
## you make.
SocksPolicy accept 127.0.0.1
SocksPolicy accept 192.168.4.5
SocksPolicy accept 192.168.0.12
SocksPolicy accept 192.168.4.8
SocksPolicy reject *