[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/06: install: Have several OS config templates under /etc/configuratio
From: |
Ludovic Courtès |
Subject: |
05/06: install: Have several OS config templates under /etc/configuration. |
Date: |
Sat, 09 May 2015 21:54:07 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit e1fbc32a0a1d027ec641ac0e249ad9aa1d5a8ffa
Author: Ludovic Courtès <address@hidden>
Date: Sat May 9 23:34:01 2015 +0200
install: Have several OS config templates under /etc/configuration.
* gnu/system/install.scm (configuration-template-service): Remove
'local-template' and 'template'. Add 'search' and 'templates'.
[activate]: Copy all of TEMPLATES to /etc/configuration.
* doc/guix.texi (System Installation): Adjust file name accordingly.
---
doc/guix.texi | 2 +-
gnu/system/install.scm | 29 ++++++++++++++++++++++-------
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index e2465ee..ea4a5c7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3927,7 +3927,7 @@ It is better to store that file on the target root file
system, say, as
A minimal operating system configuration, with just the bare minimum and
only a root account would look like this (on the installation system,
-this example is available as @file{/etc/configuration-template.scm}):
+this example is available as @file{/etc/configuration/bare-bones.scm}):
@example
@include os-config.texi
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index bba2df5..82793a6 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -32,6 +32,8 @@
#:use-module (gnu packages grub)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages compression)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-26)
#:export (self-contained-tarball
installation-os))
@@ -172,12 +174,17 @@ the given target.")
"Return a dummy service whose purpose is to install an operating system
configuration template file in the installation system."
- (define local-template
- "/etc/configuration-template.scm")
- (define template
- (search-path %load-path "gnu/system/examples/bare-bones.tmpl"))
+ (define search
+ (cut search-path %load-path <>))
+ (define templates
+ (map (match-lambda
+ ((file '-> target)
+ (list (local-file (search file))
+ (string-append "/etc/configuration/" target))))
+ '(("gnu/system/examples/bare-bones.tmpl" -> "bare-bones.scm")
+ ("gnu/system/examples/desktop.tmpl" -> "desktop.scm"))))
- (mlet %store-monad ((template (interned-file template)))
+ (with-monad %store-monad
(return (service
(requirement '(root-file-system))
(provision '(os-config-template))
@@ -186,8 +193,16 @@ configuration template file in the installation system."
(start #~(const #t))
(stop #~(const #f))
(activate
- #~(unless (file-exists? #$local-template)
- (copy-file #$template #$local-template)))))))
+ #~(begin
+ (use-modules (ice-9 match)
+ (guix build utils))
+
+ (mkdir-p "/etc/configuration")
+ (for-each (match-lambda
+ ((file target)
+ (unless (file-exists? target)
+ (copy-file file target))))
+ '#$templates)))))))
(define %nscd-minimal-caches
;; Minimal in-memory caching policy for nscd.
- branch master updated (15f0de0 -> dd51caa), Ludovic Courtès, 2015/05/09
- 01/06: gnu: wicd: Add patch to fix template instantiation., Ludovic Courtès, 2015/05/09
- 02/06: doc: Rename OS config example., Ludovic Courtès, 2015/05/09
- 03/06: services: dhcp-client: Better track dhclient's PID., Ludovic Courtès, 2015/05/09
- 04/06: doc: Add desktop configuration example., Ludovic Courtès, 2015/05/09
- 05/06: install: Have several OS config templates under /etc/configuration.,
Ludovic Courtès <=
- 06/06: doc: Show both the "bare-bones" and the "desktop" configurations., Ludovic Courtès, 2015/05/09