aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/dmd.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-06 23:58:46 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-07 00:01:06 +0100
commita348b09ea9c1dd51c4ce8e16f2f0629c64b9feb6 (patch)
tree090a19a2d055bbf63353b01a8e3281e75119093d /gnu/system/dmd.scm
parent0b8a376b68ac117646cc54d91fa54d788623b755 (diff)
downloadpatches-a348b09ea9c1dd51c4ce8e16f2f0629c64b9feb6.tar
patches-a348b09ea9c1dd51c4ce8e16f2f0629c64b9feb6.tar.gz
gnu: Move /etc/resolv.conf handling to the networking service.
* gnu/system/vm.scm (etc-directory): Remove 'resolv.conf'. (system-qemu-image): Use 'static-networking-service' with #:name-servers. Don't populate the image with /etc/resolv.conf. * gnu/system/dmd.scm (static-networking-service): Add #:name-servers parameter. Use it to populate /etc/resolv.conf.
Diffstat (limited to 'gnu/system/dmd.scm')
-rw-r--r--gnu/system/dmd.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/gnu/system/dmd.scm b/gnu/system/dmd.scm
index f4b9371ada..8a79f0a50f 100644
--- a/gnu/system/dmd.scm
+++ b/gnu/system/dmd.scm
@@ -163,6 +163,7 @@
(define* (static-networking-service interface ip
#:key
gateway
+ (name-servers '())
(inetutils inetutils)
(net-tools net-tools))
"Return a service that starts INTERFACE with address IP. If GATEWAY is
@@ -185,6 +186,17 @@ true, it must be a string specifying the default network gateway."
,(if gateway
`(zero? (system* ,route "add" "-net" "default"
"gw" ,gateway))
+ #t)
+ ,(if (pair? name-servers)
+ `(call-with-output-file "/etc/resolv.conf"
+ (lambda (port)
+ (display
+ "# Generated by 'static-networking-service'.\n"
+ port)
+ (for-each (lambda (server)
+ (format port "nameserver ~a~%"
+ server))
+ ',name-servers)))
#t))))
(stop `(lambda _
;; Return #f is successfully stopped.