aboutsummaryrefslogtreecommitdiff
path: root/gnu/installer/newt/timezone.scm
blob: 67bf41ff84d42c66d502419c074e694a9787abcb (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu installer newt timezone)
  #:use-module (gnu installer steps)
  #:use-module (gnu installer timezone)
  #:use-module (gnu installer newt page)
  #:use-module (guix i18n)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-35)
  #:use-module (ice-9 match)
  #:use-module (ice-9 receive)
  #:use-module (newt)
  #:export (run-timezone-page))

;; Information textbox width.
(define info-textbox-width (make-parameter 40))

(define (fill-timezones listbox timezones)
  "Fill the given LISTBOX with TIMEZONES. Return an association list
correlating listbox keys with timezones."
  (map (lambda (timezone)
         (let ((key (append-entry-to-listbox listbox timezone)))
           (cons key timezone)))
       timezones))

(define (run-timezone-page zonetab)
  "Run a page displaying available timezones, grouped by regions. The user is
invited to select a timezone. The selected timezone, under Posix format is
returned."
  (define (all-but-last list)
    (reverse (cdr (reverse list))))

  (define (run-page timezone-tree)
    (define (loop path)
      ;; XXX: Translation of time zones isn't perfect here because the
      ;; "iso_3166-1" domain contains translation for "territories" (like
      ;; "Antarctic") but not for continents (like "Africa").
      (let ((timezones (locate-children timezone-tree path)))
        (run-listbox-selection-page
         #:title (G_ "Timezone")
         #:info-text (G_ "Please select a timezone.")
         #:listbox-items timezones
         #:listbox-item->text (cut gettext <> "iso_3166-1")
         #:button-text (if (null? path)
                           (G_ "Exit")
                           (G_ "Back"))
         #:button-callback-procedure
         (if (null? path)
             (lambda _
               (raise
                (condition
                 (&installer-step-abort))))
             (lambda _
               (loop (all-but-last path))))
         #:listbox-callback-procedure
         (lambda (timezone)
           (let* ((timezone* (append path (list timezone)))
                  (tz (timezone->posix-tz timezone*)))
             (if (timezone-has-child? timezone-tree timezone*)
                 (loop timezone*)
                 tz))))))
    (loop '()))

  (let ((timezone-tree (zonetab->timezone-tree zonetab)))
    (run-page timezone-tree)))
. Brice Waegeneire 2021-03-10services: Prevent following symlinks during activation....This addresses a potential security issue, where a compromised service could trick the activation code in changing the permissions, owner and group of arbitrary files. However, this patch is currently only a partial fix, due to a TOCTTOU (time-of-check to time-of-use) race, which can be fixed once guile has bindings to openat and friends. Fixes: <https://lists.gnu.org/archive/html/guix-devel/2021-01/msg00388.html> * gnu/build/activation.scm: new procedure 'mkdir-p/perms'. * gnu/services/authentication.scm (%nslcd-activation, nslcd-service-type): use new procedure. * gnu/services/cups.scm (%cups-activation): likewise. * gnu/services/dbus.scm (dbus-activation): likewise. * gnu/services/dns.scm (knot-activation): likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Maxime Devos 2021-02-11services: knot: Fix configuration verification....* gnu/services/dns.scm (verify-knot-key-configuration): Fix the order of memq arguments. (verify-knot-keystore-configuration): Likewise. (verify-knot-acl-configuration): Replace fold with every procedure. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Alexey Abramov 2020-10-27services: knot-resolver: Replace deprecated command-line option....This silences a warning from the service at startup. * gnu/services/dns.scm (knot-resolver-shepherd-services)[start]: Use the "-n" command-line option to kresd in place of the deprecated "-f 1". Signed-off-by: Leo Famulari <leo@famulari.name> Simon South 2020-10-06services: dnsmasq: Add TFTP configuration fields....* gnu/services/dns.scm (<dnsmasq-configuration>): Add TFTP configuration fields. (dnsmasq-shepherd-service): Use them. * doc/guix.texi (DNS Services): Document them. Danny Milosavljevic 2020-05-08services: Add descriptions....* gnu/services/dbus.scm (polkit-service-type)[description]: New field. * gnu/services/dict.scm (dicod-service-type)[description]: New field. * gnu/services/dns.scm (knot-service-type)[description]: New field. * gnu/services/networking.scm (dhcpd-service-type)[description]: New field. * gnu/services/shepherd.scm (shepherd-root-service-type)[description]: New field. * gnu/services/xorg.scm (slim-service-type)[description]: New field. (screen-locker-service-type)[description]: New field. * gnu/system/pam.scm (pam-root-service-type)[description]: New field. * gnu/system/shadow.scm (account-service-type)[description]: New field. Ludovic Courtès 2020-05-02services: dnsmasq: Support the --address flag....Introduce a new `addresses' field that translates to passing `--address=' multiple times to dnsmasq. * gnu/services/dns.scm (<dnsmasq-configuration>): Add an addresses field. (dnsmasq-shepherd-service): Match the addresses field and translate it to multiple '--address=' flags. * doc/guix.texi (DNS Services): Document it. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Pierre Langlois