-chmod ugo+w /var/lxc
-
-PATH=$PATH:/usr/sbin:/sbin
-
-which setcap 2>&1 > /dev/null
-RES=$?
-
-if [ $RES != 0 ]; then
- echo -e "\t********************WARNING*************************"
- echo -e "\t* The 'setcap' command was not found, this is not *"
- echo -e "\t* a problem and the 'lxc' package is installed but *"
- echo -e "\t* you will have to run the 'lxc' commands as root. *"
- echo -e "\t* If you wish to run these commands as a non-root *"
- echo -e "\t* user, you will need to install libcap-2 package *"
- echo -e "\t* and reinstall the lxc package *"
- echo -e "\t****************************************************"
-else
-setcap cap_setpcap,cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-execute && \
-setcap cap_setpcap,cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-start && \
-setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-restart && \
-setcap cap_sys_admin=ep %{_bindir}/lxc-init
+if [ ! -f @LXC_DISTRO_SYSCONF@/lxc-net ] || ! grep -q 'USE_LXC_BRIDGE=' @LXC_DISTRO_SYSCONF@/lxc-net
+then
+ # Grab a random 10net subnet. Need to add test logic...
+ while [ true ]
+ do
+ SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256))
+ if ! ip -4 route ls | grep -q "^$SUBNET"
+ then
+ break
+ fi
+ done
+
+ cat > @LXC_DISTRO_SYSCONF@/lxc-net <<EOF
+# Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your
+# containers. Set to "false" if you'll use virbr0 or another existing
+# bridge, or macvlan to your host's NIC.
+USE_LXC_BRIDGE="true"
+
+# If you change the LXC_BRIDGE to something other than lxcbr0, then
+# you will also need to update your /etc/lxc/default.conf as well as the
+# configuration (/var/lib/lxc/<container>/config) for any containers
+# already created using the default config to reflect the new bridge
+# name.
+# If you have the dnsmasq daemon installed, you'll also have to update
+# /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
+LXC_BRIDGE="lxcbr0"
+LXC_BRIDGE_MAC="00:16:3e:00:00:00"
+LXC_ADDR="$SUBNET.1"
+LXC_NETMASK="255.255.255.0"
+LXC_NETWORK="$SUBNET.0/24"
+LXC_DHCP_RANGE="$SUBNET.2,$SUBNET.254"
+LXC_DHCP_MAX="253"
+# Uncomment the next line if you'd like to use a conf-file for the lxcbr0
+# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
+# container 'mail1' always get ip address 10.0.3.100.
+#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
+
+# Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc
+# domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR)
+# to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your
+# host.
+#LXC_DOMAIN="lxc"
+EOF