# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../unet/b14b068f16ac1df54155a3174b32b458d53d4281.patch # Copyright (C) 2009 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From b14b068f16ac1df54155a3174b32b458d53d4281 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Tue, 17 Feb 2009 17:05:11 +0000 Subject: unet-dhcp: added 'down' support when using runit-mode --- diff --git a/unet-dhcp.in b/unet-dhcp.in index 6f9840d..4129ebc 100644 --- a/unet-dhcp.in +++ b/unet-dhcp.in @@ -63,7 +63,19 @@ if [ "x$1" = "xdown" ]; then [ "$iface_type" = "dhcp" ] || die "$iface: Not dhcp." - die "$action: Not Yet Implemented." + if [ -n "$servicedir" ]; then + # runit + myservice="$rundatadir/service/$iface" + + $sv force-stop "$myservice" + $sv d "$myservice/log" + + rm "$servicedir/$iface" + + $sv e "$myservice" + else + die "$action: Not Yet Implemented." + fi fi elif [ -s "$iface_file" ]; then die "$iface: Interface already started." @@ -84,6 +96,15 @@ else exec udhcpc -f -i $iface -s "$sbindir/unet-udhcpc" EOT + cat > "$myservice/finish" <<-EOT + #!/bin/sh + exec 2>&1 + + export interface=$iface + + exec "$sbindir/unet-udhcpc" down + EOT + cat > "$myservice/log/run" <<-EOT #!/bin/sh @@ -92,7 +113,7 @@ else exec svlogd -tt "$logdir" EOT - chmod +x "$myservice/run" "$myservice/log/run" + chmod +x "$myservice/run" "$myservice/log/run" "$myservice/finish" ln -snf "$myservice" "$servicedir/$iface" else -- cgit v0.8.1