From 50cb948f1c584344c63129e535c2fe7b54332a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 2 Jul 2017 16:38:06 +0200 Subject: install: Re-add /bin/sh. Reported by Divan Santana . /bin/sh had disappeared in commit 387e175492f960d7d86f34f3b2e43938fa72dbf3. * gnu/system/install.scm (%installation-services): Add 'special-files-service-type' instance. --- gnu/system/install.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 0a78d030dd..2c408c109a 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -277,7 +277,13 @@ You have been warned. Thanks for being so brave. ;; Since this is running on a USB stick with a unionfs as the root ;; file system, use an appropriate cache configuration. (nscd-service (nscd-configuration - (caches %nscd-minimal-caches)))))) + (caches %nscd-minimal-caches))) + + ;; Having /bin/sh is a good idea. In particular it allows Tramp + ;; connections to this system to work. + (service special-files-service-type + `(("/bin/sh" ,(file-append (canonical-package bash) + "/bin/sh"))))))) (define %issue ;; Greeting. -- cgit v1.2.3 From ed3485fa9c6c758bff1fb7391c8360c2c93e7337 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Thu, 29 Jun 2017 05:17:33 +0200 Subject: linux-initrd: Add isofs if necessary. * gnu/system/linux-initrd.scm (base-initrd): Add isofs. --- gnu/system/linux-initrd.scm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 3a5e76034a..89caf83256 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -285,6 +285,9 @@ loaded at boot time in the order in which they appear." ,@(if (find (file-system-type-predicate "btrfs") file-systems) '("btrfs") '()) + ,@(if (find (file-system-type-predicate "iso9660") file-systems) + '("isofs") + '()) ,@(if volatile-root? '("fuse") '()) -- cgit v1.2.3 From be1033a3349069ee722bf25c804b3bfee4467886 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 3 Jul 2017 10:05:03 +0200 Subject: build: Add iso9660 system image generator. * build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image . * gnu/build/vm.scm (make-iso9660-image): New variable. Export it. * gnu/system/vm.scm (iso9660-image): New variable. Use make-iso9660-image. (system-disk-image): Use iso9660-image. --- gnu/system/vm.scm | 80 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 13 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 7ac8696158..f1c650c97b 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -34,6 +34,7 @@ #:select (qemu-command)) #:use-module (gnu packages base) #:use-module (gnu packages bootloaders) + #:use-module (gnu packages cdrom) #:use-module (gnu packages guile) #:use-module (gnu packages gawk) #:use-module (gnu packages bash) @@ -174,6 +175,48 @@ made available under the /xchg CIFS share." #:guile-for-build guile-for-build #:references-graphs references-graphs))) +(define* (iso9660-image #:key + (name "iso9660-image") + (system (%current-system)) + (qemu qemu-minimal) + os-drv + bootcfg-drv + bootloader + (inputs '())) + "Return a bootable, stand-alone iso9660 image. + +INPUTS is a list of inputs (as for packages)." + (expression->derivation-in-linux-vm + name + (with-imported-modules (source-module-closure '((gnu build vm) + (guix build utils))) + #~(begin + (use-modules (gnu build vm) + (guix build utils)) + + (let ((inputs + '#$(append (list qemu parted e2fsprogs dosfstools xorriso) + (map canonical-package + (list sed grep coreutils findutils gawk)))) + + ;; This variable is unused but allows us to add INPUTS-TO-COPY + ;; as inputs. + (to-register + '#$(map (match-lambda + ((name thing) thing) + ((name thing output) `(,thing ,output))) + inputs))) + + (set-path-environment-variable "PATH" '("bin" "sbin") inputs) + (make-iso9660-image #$(bootloader-package bootloader) + #$bootcfg-drv + #$os-drv + "/xchg/guixsd.iso") + (reboot)))) + #:system system + #:make-disk-image? #f + #:references-graphs inputs)) + (define* (qemu-image #:key (name "qemu-image") (system (%current-system)) @@ -318,19 +361,30 @@ to USB sticks meant to be read-only." (mlet* %store-monad ((os-drv (operating-system-derivation os)) (bootcfg (operating-system-bootcfg os))) - (qemu-image #:name name - #:os-drv os-drv - #:bootcfg-drv bootcfg - #:bootloader (bootloader-configuration-bootloader - (operating-system-bootloader os)) - #:disk-image-size disk-image-size - #:disk-image-format "raw" - #:file-system-type file-system-type - #:file-system-label root-label - #:copy-inputs? #t - #:register-closures? #t - #:inputs `(("system" ,os-drv) - ("bootcfg" ,bootcfg)))))) + (if (string=? "iso9660" file-system-type) + (iso9660-image #:name name + #:os-drv os-drv + #:bootcfg-drv bootcfg + #:bootloader (bootloader-configuration-bootloader + (operating-system-bootloader os)) + #:inputs `(("system" ,os-drv) + ("bootcfg" ,bootcfg))) + (qemu-image #:name name + #:os-drv os-drv + #:bootcfg-drv bootcfg + #:bootloader (bootloader-configuration-bootloader + (operating-system-bootloader os)) + #:disk-image-size disk-image-size + #:disk-image-format "raw" + #:file-system-type (if (string=? "iso9660" + file-system-type) + "ext4" + file-system-type) + #:file-system-label root-label + #:copy-inputs? #t + #:register-closures? #t + #:inputs `(("system" ,os-drv) + ("bootcfg" ,bootcfg))))))) (define* (system-qemu-image os #:key -- cgit v1.2.3 From 6db571cbf0488a4c6a9f24de25a2f5619e59faa2 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 29 Jun 2017 18:43:33 +0200 Subject: install: Drop redundant package after c0f5eee4b2cc737be222c4ba331d0. * gnu/system/install.scm (installation-os): Remove SHADOW. --- gnu/system/install.scm | 1 - 1 file changed, 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 2c408c109a..d5d11371a3 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -347,7 +347,6 @@ Use Alt-F2 for documentation. (base-pam-services #:allow-empty-passwords? #t)) (packages (cons* (canonical-package glibc) ;for 'tzselect' & co. - shadow ;'passwd', for easy SSH access parted gptfdisk ddrescue grub ;mostly so xrefs to its manual work cryptsetup -- cgit v1.2.3 From 6d9a859038b33c1bde35df915f101b58774bce06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 4 Jul 2017 22:05:21 +0200 Subject: linux-initrd: Avoid monadic style a bit. * gnu/system/linux-initrd.scm (expression->initrd): Use 'program-file' for 'init'. (flat-linux-module-directory): Use 'computed-file' instead of 'gexp->derivation'. (raw-initrd): Adjust accordingly. --- gnu/system/linux-initrd.scm | 108 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 53 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 89caf83256..5a7aec5c87 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -68,24 +68,25 @@ the derivations referenced by EXP are automatically copied to the initrd." ;; General Linux overview in `Documentation/early-userspace/README' and ;; `Documentation/filesystems/ramfs-rootfs-initramfs.txt'. - (mlet %store-monad ((init (gexp->script "init" exp - #:guile guile))) - (define builder - (with-imported-modules (source-module-closure - '((gnu build linux-initrd))) - #~(begin - (use-modules (gnu build linux-initrd)) - - (mkdir #$output) - (build-initrd (string-append #$output "/initrd") - #:guile #$guile - #:init #$init - ;; Copy everything INIT refers to into the initrd. - #:references-graphs '("closure") - #:gzip (string-append #$gzip "/bin/gzip"))))) - - (gexp->derivation name builder - #:references-graphs `(("closure" ,init))))) + (define init + (program-file "init" exp #:guile guile)) + + (define builder + (with-imported-modules (source-module-closure + '((gnu build linux-initrd))) + #~(begin + (use-modules (gnu build linux-initrd)) + + (mkdir #$output) + (build-initrd (string-append #$output "/initrd") + #:guile #$guile + #:init #$init + ;; Copy everything INIT refers to into the initrd. + #:references-graphs '("closure") + #:gzip (string-append #$gzip "/bin/gzip"))))) + + (gexp->derivation name builder + #:references-graphs `(("closure" ,init)))) (define (flat-linux-module-directory linux modules) "Return a flat directory containing the Linux kernel modules listed in @@ -132,7 +133,7 @@ MODULES and taken from LINUX." (basename module)))) (delete-duplicates modules))))) - (gexp->derivation "linux-modules" build-exp)) + (computed-file "linux-modules" build-exp)) (define* (raw-initrd file-systems #:key @@ -165,40 +166,41 @@ to it are lost." (open source target))) mapped-devices)) - (mlet %store-monad ((kodir (flat-linux-module-directory linux - linux-modules))) - (expression->initrd - (with-imported-modules (source-module-closure - '((gnu build linux-boot) - (guix build utils) - (guix build bournish) - (gnu build file-systems))) - #~(begin - (use-modules (gnu build linux-boot) - (guix build utils) - (guix build bournish) ;add the 'bournish' meta-command - (srfi srfi-26) - - ;; FIXME: The following modules are for - ;; LUKS-DEVICE-MAPPING. We should instead propagate - ;; this info via gexps. - ((gnu build file-systems) - #:select (find-partition-by-luks-uuid)) - (rnrs bytevectors)) - - (with-output-to-port (%make-void-port "w") - (lambda () - (set-path-environment-variable "PATH" '("bin" "sbin") - '#$helper-packages))) - - (boot-system #:mounts '#$(map file-system->spec file-systems) - #:pre-mount (lambda () - (and #$@device-mapping-commands)) - #:linux-modules '#$linux-modules - #:linux-module-directory '#$kodir - #:qemu-guest-networking? #$qemu-networking? - #:volatile-root? '#$volatile-root?))) - #:name "raw-initrd"))) + (define kodir + (flat-linux-module-directory linux linux-modules)) + + (expression->initrd + (with-imported-modules (source-module-closure + '((gnu build linux-boot) + (guix build utils) + (guix build bournish) + (gnu build file-systems))) + #~(begin + (use-modules (gnu build linux-boot) + (guix build utils) + (guix build bournish) ;add the 'bournish' meta-command + (srfi srfi-26) + + ;; FIXME: The following modules are for + ;; LUKS-DEVICE-MAPPING. We should instead propagate + ;; this info via gexps. + ((gnu build file-systems) + #:select (find-partition-by-luks-uuid)) + (rnrs bytevectors)) + + (with-output-to-port (%make-void-port "w") + (lambda () + (set-path-environment-variable "PATH" '("bin" "sbin") + '#$helper-packages))) + + (boot-system #:mounts '#$(map file-system->spec file-systems) + #:pre-mount (lambda () + (and #$@device-mapping-commands)) + #:linux-modules '#$linux-modules + #:linux-module-directory '#$kodir + #:qemu-guest-networking? #$qemu-networking? + #:volatile-root? '#$volatile-root?))) + #:name "raw-initrd")) (define* (file-system-packages file-systems #:key (volatile-root? #f)) "Return the list of statically-linked, stripped packages to check -- cgit v1.2.3 From acc0f6bb5885e661a406a367a9543debc455221a Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 3 Jul 2017 19:57:50 +0200 Subject: guix system: Add file system label and uuid to iso9660-image. * gnu/system/vm.scm (system-disk-image): Pass root-label to ... (iso9660-image): ... here. Add keyword arguments #:file-system-label and #:file-system-uuid. --- gnu/system/vm.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index f1c650c97b..3e722d0815 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -177,6 +177,8 @@ made available under the /xchg CIFS share." (define* (iso9660-image #:key (name "iso9660-image") + file-system-label + file-system-uuid (system (%current-system)) (qemu qemu-minimal) os-drv @@ -211,7 +213,9 @@ INPUTS is a list of inputs (as for packages)." (make-iso9660-image #$(bootloader-package bootloader) #$bootcfg-drv #$os-drv - "/xchg/guixsd.iso") + "/xchg/guixsd.iso" + #:volume-id #$file-system-label + #:volume-uuid #$file-system-uuid) (reboot)))) #:system system #:make-disk-image? #f @@ -363,6 +367,8 @@ to USB sticks meant to be read-only." (bootcfg (operating-system-bootcfg os))) (if (string=? "iso9660" file-system-type) (iso9660-image #:name name + #:file-system-label root-label + #:file-system-uuid #f #:os-drv os-drv #:bootcfg-drv bootcfg #:bootloader (bootloader-configuration-bootloader -- cgit v1.2.3 From 651de2bdb5fd451c50933dcf8d647d470d826261 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 10 Jul 2017 03:23:30 +0200 Subject: build, vm: Use "GuixSD" or "GUIXSD" as volume label. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/build/vm.scm (initialize-hard-disk): Use "GuixSD" as label. * gnu/system/install.scm (installation-os): Use "GuixSD" as label. * gnu/system/vm.scm (system-disk-image): Use "GuixSD" or "GUIXSD" as volume label. Co-authored-by: Ludovic Courtès --- gnu/system/install.scm | 2 +- gnu/system/vm.scm | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index d5d11371a3..f9aa7f6733 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -306,7 +306,7 @@ Use Alt-F2 for documentation. ;; the appropriate one. (cons* (file-system (mount-point "/") - (device "gnu-disk-image") + (device "GuixSD") (title 'label) (type "ext4")) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 3e722d0815..66a2448ceb 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -335,11 +335,17 @@ the image." system described by OS. Said image can be copied on a USB stick as is. When VOLATILE? is true, the root file system is made volatile; this is useful to USB sticks meant to be read-only." + (define normalize-label + ;; ISO labels are all-caps (case-insensitive), but since + ;; 'find-partition-by-label' is case-sensitive, make it all-caps here. + (if (string=? "iso9660" file-system-type) + string-upcase + identity)) (define root-label ;; Volume name of the root file system. Since we don't know which device ;; will hold it, we use the volume name to find it (using the UUID would ;; be even better, but somewhat less convenient.) - "gnu-disk-image") + (normalize-label "GuixSD")) (define file-systems-to-keep (remove (lambda (fs) -- cgit v1.2.3