system: Export 'local-host-aliases'.
authorLudovic Courtès <ludo@gnu.org>
Tue, 7 Oct 2014 19:17:22 +0000 (21:17 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 7 Oct 2014 21:18:41 +0000 (23:18 +0200)
* gnu/system.scm (local-host-aliases): New procedure.
  (default-/etc/hosts): Use it.

gnu/system.scm

index ed8289b..9906695 100644 (file)
@@ -75,6 +75,7 @@
             operating-system-profile
             operating-system-grub.cfg
 
+            local-host-aliases
             %setuid-programs
             %base-packages
 
@@ -318,11 +319,14 @@ explicitly appear in OS."
   "
 This is the GNU system.  Welcome.\n")
 
+(define (local-host-aliases host-name)
+  "Return aliases for HOST-NAME, to be used in /etc/hosts."
+  (string-append "127.0.0.1 localhost " host-name "\n"
+                 "::1       localhost " host-name "\n"))
+
 (define (default-/etc/hosts host-name)
   "Return the default /etc/hosts file."
-  (text-file "hosts"
-             (string-append "127.0.0.1 localhost " host-name "\n"
-                            "::1       localhost " host-name "\n")))
+  (text-file "hosts" (local-host-aliases host-name)))
 
 (define* (etc-directory #:key
                         (locale "C") (timezone "Europe/Paris")