aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; 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 ethernet)
  #:use-module (gnu installer connman)
  #:use-module (gnu installer steps)
  #:use-module (gnu installer newt utils)
  #:use-module (gnu installer newt page)
  #:use-module (guix i18n)
  #:use-module (ice-9 format)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-35)
  #:export (run-ethernet-page))

(define (ethernet-services)
  "Return all the connman services of ethernet type."
  (let ((services (connman-services)))
    (filter (lambda (service)
              (and (string=? (service-type service) "ethernet")
                   (not (string-null? (service-name service)))))
            services)))

(define (ethernet-service->text service)
  "Return a string describing the given ethernet SERVICE."
  (let* ((name (service-name service))
         (path (service-path service))
         (full-name (string-append name "-" path))
         (state (service-state service))
         (connected? (or (string=? state "online")
                         (string=? state "ready"))))
    (format #f "~c ~a~%"
            (if connected? #\* #\ )
            full-name)))

(define (connect-ethernet-service service)
  "Connect to the given ethernet SERVICE. Display a connecting page while the
connection is pending."
  (let* ((service-name (service-name service))
         (form (draw-connecting-page service-name)))
    (connman-connect service)
    (destroy-form-and-pop form)
    service))

(define (run-ethernet-page)
  (match (ethernet-services)
    (()
     (run-error-page
      (G_ "No ethernet service available, please try again.")
      (G_ "No service"))
     (abort-to-prompt 'installer-step 'abort))
    ((service)
     ;; Only one service is available so return it directly.
     service)
    ((services ...)
     (run-listbox-selection-page
      #:info-text (G_ "Please select an ethernet network.")
      #:title (G_ "Ethernet connection")
      #:listbox-items services
      #:listbox-item->text ethernet-service->text
      #:listbox-height (min (+ (length services) 2) 5)
      #:button-text (G_ "Exit")
      #:button-callback-procedure
      (lambda _
        (abort-to-prompt 'installer-step 'abort))
      #:listbox-callback-procedure connect-ethernet-service))))
4648273f174f65e'>gnu: Use PACKAGE/INHERIT in more places....* gnu/packages/algebra.scm (fftwf, fftw-openmpi), gnu/packages/audio.scm (ztoolkit-rsvg), gnu/packages/bioinformatics.scm (python2-dendropy), gnu/packages/boost.scm (boost-with-python2), gnu/packages/check.scm (python2-mock, python2-pytest-mock), gnu/packages/cups.scm (hplip-minimal), gnu/packages/freedesktop.scm (libinput-minimal), gnu/packages/gettext.scm (gnu-gettext), gnu/packages/glib.scm (python2-pygobject), gnu/packages/gnome.scm (gdl-minimal, libsoup-minimal, python2-pyatspi), gnu/packages/groff.scm (groff-minimal), gnu/packages/jami.scm (ffmpeg-jami), gnu/packages/libcanberra.scm (libcanberra/gtk+-2), gnu/packages/lirc.scm (python2-lirc), gnu/packages/llvm.scm (clang-runtime-3.5), gnu/packages/mpi.scm (java-openmpi, openmpi-thread-multiple), gnu/packages/node.scm (libnode), gnu/packages/onc-rpc.scm (libtirpc/hurd), gnu/packages/python-compression.scm (bitshuffle-for-snappy), gnu/packages/python-crypto.scm (python2-pycrypto, python2-cryptography) (python2-cryptography, python2-m2crypto), gnu/packages/python-web.scm (python2-html2text, python2-tornado) (python2-terminado, python2-ndg-httpsclient, python2-websocket-client) (python2-rauth, python2-url, python2-s3transfer), gnu/packages/python-xyz.scm (python2-psutil, python2-serpent) (python2-humanfriendly, python2-empy, python2-parse-type, python2-polib) (python2-jsonschema, python2-pystache, python2-cython, python2-numpydoc) (python2-ipyparallel, python2-traitlets, python2-dbus) (python2-beautifulsoup4, python2-pep517, python2-flake8, python2-llfuse) (python2-tlsh, python-file, python2-notebook, python-jupyter-console-minimal) (python2-contextlib2, python2-promise, python2-anyjson, python2-amqp) (python2-kombu, python2-billiard, python2-celery, python2-whoosh) (python2-jellyfish, python-rope, ptpython-2, python2-binaryornot) (python2-setproctitle, python2-argcomplete, python2-xopen, python2-isort) (python2-radon, python2-rfc6555, python2-activepapers, python2-send2trash) (python2-cloudpickle, python2-reparser), gnu/packages/python.scm (python2-called-python), gnu/packages/qt.scm (python2-sip, python-pyqt-without-qtwebkit, python2-pyqt) (python-qscintilla, python-pyqt+qscintilla), gnu/packages/scanner.scm (sane-backends), gnu/packages/sdl.scm (guile3.0-sdl2), gnu/packages/selinux.scm (checkpolicy, libselinux, libsemanage, secilc) (python-sepolgen, policycoreutils), gnu/packages/serialization.scm (lua5.1-libmpack, lua5.2-libmpack), gnu/packages/simulation.scm (fenics), gnu/packages/statistics.scm (python2-statsmodels), gnu/packages/texinfo.scm (info-reader), gnu/packages/wxwidgets.scm (wxwidgets-gtk2, wxwidgets-gtk2-3.1), gnu/packages/xml.scm (xmlsec-nss), gnu/packages/xorg.scm (uim-gtk, uim-qt), guix/build-system/python.scm (package-with-explicit-python) (strip-python2-variant): Use PACKAGE/INHERIT. Mark H Weaver 2021-03-06gnu: epson-inkjet-printer-escpr: Update to 1.7.9....* gnu/packages/cups.scm (epson-inkjet-printer-escpr): Update to 1.7.9. Tobias Geerinckx-Rice 2021-03-06gnu: hplip: Update to 3.21.2....* gnu/packages/cups.scm (hplip): Update to 3.21.2. * gnu/packages/patches/hplip-remove-imageprocessor.patch: Adapt. Tobias Geerinckx-Rice 2021-01-10gnu: Move brlaser to (gnu packages cups)....* gnu/packages/printers.scm (cups): Move from here... * gnu/packages/cups.scm (cups): ...to here. Tobias Geerinckx-Rice 2020-12-15gnu: foo2zjs: Fix installation....* gnu/packages/cups.scm (foo2zjs)[inputs]: Add coreutils and sed. [arguments]: Add new phases ''make-install-dirs', 'wrap-wrappers', and 'install-cups-filters-symlinks'. Signed-off-by: Leo Famulari <leo@famulari.name> Boris A. Dekshteyn 2020-12-06gnu: hplip: Update to 3.20.11....* gnu/packages/cups.scm (hplip): Update to 3.20.11. [source]: Remove upstreamed patch. * gnu/packages/patches/hplip-fix-bug-1898438.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. Tobias Geerinckx-Rice 2020-11-29gnu: hplip: Install PPDs into a separate output....* gnu/packages/cups.scm (hplip)[outputs]: Add a :ppd output. [arguments]: Install the .ppd files there. Tobias Geerinckx-Rice 2020-11-21gnu: Rename escpr to epson-inkjet-printer-escpr....‘escpr’ is nice and short, but everyone else calls this package ‘epson-inkjet-printer-escpr’. More importantly, so does upstream. * gnu/packages/cups.scm (escpr, epson-inkjet-printer-escpr,): Rename escpr to epson-inkjet-printer-escpr, redefining escpr as deprecated-package. Adjust all users. Tobias Geerinckx-Rice 2020-11-21gnu: escpr: Omit static library....* gnu/packages/cups.scm (escpr)[arguments]: Add "--disable-static" to #:configure-flags. Tobias Geerinckx-Rice 2020-11-19gnu: escpr: Compress PPDs....* gnu/packages/cups.scm (escpr)[arguments]: Import SRFI-26 and add a ‘compress-PPDs’ phase. Tobias Geerinckx-Rice 2020-11-19gnu: escpr: Use HTTPS, more relevant home page....* gnu/packages/cups.scm (escpr)[home-page]: Use HTTPS. Pre-set the OSC parameter most relevant to GNU. Tobias Geerinckx-Rice 2020-11-19gnu: escpr: Update to 1.7.8....* gnu/packages/cups.scm (escpr): Update to 1.7.8. Tobias Geerinckx-Rice 2020-11-18gnu: splix: Compress PPDs....* gnu/packages/cups.scm (splix)[arguments]: Import SRFI-26 and add a ‘compress-PPDs’ phase. Tobias Geerinckx-Rice 2020-11-18gnu: splix: Update to 2.0.0-315.76268c4....* gnu/packages/cups.scm (splix): Update to 2.0.0-315.76268c4. [source]: Fetch from a more maintained git repository. [arguments]: Add an ‘enter-subdirectory’ phase. [inputs]: Remove instructions for building without JBIG. It's no longer patented. Tobias Geerinckx-Rice 2020-10-04gnu: hplip: Update to 3.20.9 [security fixes]....* gnu/packages/cups.scm (hplip): Update to 3.20.9. [source]: Add hplip-fix-bug-1898438.patch. [arguments]: Follow upstream defaults. * gnu/packages/patches/hplip-fix-bug-1898438.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Tobias Geerinckx-Rice 2020-10-01gnu: escpr: Mark up description....* gnu/packages/cups.scm (escpr)[description]: Use @acronym and @tie. Tobias Geerinckx-Rice 2020-09-29gnu: escpr: Update to 1.7.7....* gnu/packages/cups.scm (escpr): Update to 1.7.7. [arguments]: Add a ‘patch-autotools-version-requirement’ phase. Tobias Geerinckx-Rice 2020-09-29gnu: escpr: Install PPDs where CUPS can find them....* gnu/packages/cups.scm (escpr)[arguments]: Fix ‘--with-cupsppddir=’. Tobias Geerinckx-Rice