nixpkgs/pkgs/os-specific/linux/fanctl/robustness.patch
Charles Strahan ad7b1e24c2 fan-networking: updated patches from Ubuntu
This pulls in updated Fan Networking patches from Ubuntu.
(https://wiki.ubuntu.com/FanNetworking)

closes #14328
2016-04-10 16:07:03 -04:00

86 lines
1.8 KiB
Diff

diff --git a/fanctl b/fanctl
index 4338b75..84cf987 100755
--- a/fanctl
+++ b/fanctl
@@ -5,6 +5,8 @@
# fanctl down 15 10.1.0.1
#
+export PATH="@PATH@"
+
usage()
{
echo "Usage: $0 <cmd> [<options>...]" 1>&2
@@ -23,8 +25,8 @@ run()
"$@"
}
-state_dir="/run/ubuntu-fan"
-lconfig_dir="/var/lib/ubuntu-fan/config"
+state_dir="/run/fan-networking"
+lconfig_dir="/var/lib/fan-networking/config"
__ip_split()
{
@@ -931,12 +933,12 @@ dhcp_reconfigure()
--strict-order \
--bind-interfaces \
--pid-file="$state_dir/dnsmasq-$C_bridge_state.pid" \
- --conf-file= \
+ --conf-file=/dev/null \
$dhcp_flags \
--dhcp-no-override \
--except-interface=lo \
--interface="$C_bridge" \
- --dhcp-leasefile=/var/lib/misc/dnsmasq."$C_bridge_state".leases \
+ --dhcp-leasefile=/var/lib/fan-networking/dnsmasq."$C_bridge_state".leases \
--dhcp-authoritative \
|| $fail "$C_bridge: failed to start dnsmasq"
@@ -1559,21 +1561,23 @@ cmd_config()
case "$cmd" in
list|ls)
- ls -1 "$lconfig_dir" | \
- while read config
- do
- case "$config" in
- *.conf) ;;
- *) continue ;;
- esac
+ if [ -d $lconfig_dir ]; then
+ ls -1 "$lconfig_dir" | \
+ while read config
+ do
+ case "$config" in
+ *.conf) ;;
+ *) continue ;;
+ esac
- config=$( echo "$config" | sed \
- -e 's/.conf$//' \
- -e 's/--/ /g' \
- -e 's@-@/@g'
- )
- echo "$config"
- done
+ config=$( echo "$config" | sed \
+ -e 's/.conf$//' \
+ -e 's/--/ /g' \
+ -e 's@-@/@g'
+ )
+ echo "$config"
+ done
+ fi
;;
show)
cmd_decode_init
@@ -1588,6 +1592,7 @@ cmd_config()
[ -f "$uconfig" ] && cat "$uconfig"
;;
set)
+ mkdir -p $lconfig_dir || fail "could not create config directory ($lconfig_dir)"
cmd_decode_init
if ! cmd_decode_config "config set" "$@"; then
fail "invalid config"