Commit graph

229 commits

Author SHA1 Message Date
Ludovic Courtès
9976c76aab
file-systems: Preserve UUID types when serializing.
Reported by Roel Janssen <roel@gnu.org>
at <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>.

* gnu/system/file-systems.scm (file-system->spec): When DEVICE is a
UUID, serialize it in a way that preserves its type.
(spec->file-system): Adjust accordingly.
* gnu/build/file-systems.scm (canonicalize-device-spec): Add case for
when SPEC is 'uuid?'.
2017-10-11 11:12:33 +02:00
Ludovic Courtès
1c65cca574
file-systems: 'mount-file-system' now takes a <file-system> object.
* gnu/build/file-systems.scm (mount-file-system): Rename 'spec' to 'fs'
and assume it's a <file-system>.
* gnu/build/linux-boot.scm (boot-system): Assume MOUNTS is a list of
<file-system> and adjust accordingly.
* gnu/build/linux-container.scm (mount-file-systems): Remove
'file-system->spec' call.
* gnu/services/base.scm (file-system-shepherd-service): Add
'spec->file-system' call.  Add (gnu system file-systems) to 'modules'.
* gnu/system/linux-initrd.scm (raw-initrd): Use (gnu system
file-systems).  Add 'spec->file-system' call for #:mounts.
2017-10-11 11:12:33 +02:00
Ludovic Courtès
5e66574a12
activation: Do not create setuid binaries in the store [security fix].
Fixes <https://bugs.gnu.org/28751>.

* gnu/build/activation.scm (activate-setuid-programs)[link-or-copy]: Remove.
Use 'copy-file' instead.
2017-10-08 21:27:48 +02:00
Ludovic Courtès
aed1f1b049
uuid: Add 'uuid=?' and use it.
* gnu/system/uuid.scm (uuid=?): New procedure.
* tests/uuid.scm ("uuid=?"): New test.
* gnu/build/file-systems.scm (partition-uuid-predicate)
(luks-partition-uuid-predicate): Use it instead of 'bytevector=?'.
2017-10-05 12:09:17 +02:00
Danny Milosavljevic
b43b9acf15
build: Do not store two copies of the ISO-9660 superblock anymore.
* gnu/build/vm.scm (make-iso9660-image): Do not store two copies of the
ISO-9660 superblock anymore.
2017-09-22 04:03:52 +02:00
Ludovic Courtès
47cef4ecad
file-systems: Introduce (gnu system uuid).
* gnu/build/file-systems.scm (sub-bytevector)
(latin1->string, %fat32-endianness, fat32-uuid->string)
(%iso9660-uuid-rx, string->iso9660-uuid)
(iso9660-uuid->string, %network-byte-order)
(dce-uuid->string, %uuid-rx, string->dce-uuid)
(string->ext2-uuid, string->ext3-uuid, string->ext4-uuid)
(vhashq, %uuid-parsers, %uuid-printers, string->uuid)
(uuid->string): Move to...
* gnu/system/uuid.scm: ... here.  New file.
* gnu/system/file-systems.scm (uuid): Move to the above file.
* gnu/system/vm.scm: Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add uuid.scm.
2017-09-11 22:24:46 +02:00
Ludovic Courtès
a8e1247d7d
file-systems: Add UUID type dictionaries.
* gnu/build/file-systems.scm (uuid->string): Rename to...
(dce-uuid->string): ... this.
(string->uuid): Rename to...
(string->dce-uuid): ... this.
(vhashq): New macro.
(%uuid-parsers, %uuid-printers): New variables.
(uuid->string, string->uuid): New procedures.
2017-09-11 22:24:46 +02:00
Ludovic Courtès
bae28ccb69
vm: Allow partitions to be initialized with a given UUID.
* gnu/build/vm.scm (<partition>)[uuid]: New field.
(create-ext-file-system): Add #:uuid and honor it.
(create-fat-file-system): Add #:uuid.
(format-partition): Add #:uuid and honor it.
(initialize-partition): Honor the 'uuid' field of PARTITION.
2017-09-11 22:24:46 +02:00
Christopher Baines
575065bd1c
vm: Add comment about deduplication in make-iso9660-image.
* gnu/build/vm.scm (make-iso9660-image): Add comment about the use of
  #:deduplicate #f when calling register-closure.
2017-09-10 11:59:55 +01:00
Ludovic Courtès
13877c3453
marionette: 'wait-for-file' can be passed a read procedure.
* gnu/build/marionette.scm (wait-for-file): Add #:read parameter and
honor it.
* gnu/tests/base.scm (run-basic-test)["login on tty1"]: Use
'wait-for-file' instead of inline code.
2017-09-08 00:11:21 +02:00
Christopher Baines
309b8fe7e6
vm: Create /mnt in the generated ISO image in make-iso9660-image.
This is used in the installation process, as the mountpoint for the target
filesystem.

* gnu/build/vm.scm (make-iso9660-image): Create /mnt within the generated ISO
  image.
2017-09-06 08:43:44 +01:00
Christopher Baines
22bbdb5f79
vm: Add support for registering closures to make-iso9660-image.
This mimics the functionality in the root-partition-initializer used in
creating the QEMU image. This helps when trying to run guix system init from
the generated ISO image.

* gnu/build/vm.scm (make-iso9660-image): Add support for registering closures.
2017-09-06 08:43:38 +01:00
Ludovic Courtès
06b8eae3d1
marionette: Augment the set of keystrokes.
* gnu/build/marionette.scm (%qwerty-us-keystrokes): Add ', ", and `.
2017-08-28 09:56:33 +02:00
Ludovic Courtès
0a80981178
marionette: Fix typing of capital letters.
Previously we'd use "sendkey P" instead of "sendkey shift-p", which had
no effect.

* gnu/build/marionette.scm (character->keystroke): New procedure.
(string->keystroke-commands): Use it.
2017-08-28 09:56:33 +02:00
Ludovic Courtès
8bd5231485
marionette: 'wait-for-file' really raises an error when a file is missing.
* gnu/build/marionette.scm (wait-for-file): Arrange to call 'error' on
the host, not in the guest.
2017-08-28 09:56:33 +02:00
Danny Milosavljevic
9833bcfc08
build: Allow mounting of entire disks.
* gnu/build/file-systems.scm (disk-partitions): Also return entire drives.
2017-08-05 18:49:33 +02:00
Ludovic Courtès
49962b15a1
activation: Make sure /etc exists.
Fixes <http://bugs.gnu.org/27146>.
Reported by ng0 <ng0@pragmatique.xyz>.

* gnu/build/activation.scm (activate-etc): Add call to 'mkdir-p'.
2017-08-03 00:35:59 +02:00
Ludovic Courtès
8d033e3e16
vm: 'iso9660-image' produces a single-file output.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add
  #:single-file-output? and pass it to 'load-in-linux-vm'.
(iso9660-image): Pass #:single-file-output? to
'expression->derivation-in-linux-vm'.
* gnu/build/vm.scm (load-in-linux-vm): Add #:single-file-output? and
honor it.
2017-07-18 21:41:35 +02:00
Tobias Geerinckx-Rice
21ffcd65c5
vm: Increase disk size overhead estimate.
* gnu/build/vm.scm (estimated-partition-size): Add 25% to the graph size.
2017-07-18 17:14:38 +02:00
Tobias Geerinckx-Rice
0862b95433
build, vm: Use a less common label.
* gnu/build/vm.scm (initialize-hard-disk): Use "GuixSD_image" as label.
* gnu/system/install.scm (installation-os): Likewise.
* gnu/system/vm.scm (system-disk-image): Likewise.
2017-07-17 20:20:24 +02:00
Danny Milosavljevic
911a53a53f
build: Make ISO-9660 image bootable from USB flash drive.
* gnu/build/vm.scm (make-iso9660-image): Make image bootable from USB flash
drive.
2017-07-12 16:15:30 +02:00
Danny Milosavljevic
651de2bdb5
build, vm: Use "GuixSD" or "GUIXSD" as volume label.
* 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 <ludo@gnu.org>
2017-07-10 15:35:43 +02:00
Danny Milosavljevic
08c1f2d21c
build: Add (gnu build file-systems) import.
* gnu/build/vm.scm: Add (gnu build file-systems) import.
2017-07-03 16:33:46 +02:00
Danny Milosavljevic
4f80be730e
build: Clarify error message when make-iso9660-image fails.
* gnu/build/vm.scm (make-iso9660-image): Clarify error message.
2017-07-03 15:13:09 +02:00
Danny Milosavljevic
1feb3076cb
build: Allow specifying volume-uuid with make-iso9660-image.
* gnu/build/file-systems.scm (iso9660-uuid->string): Export.
* gnu/build/vm.scm (make-iso9660-image): Add volume-uuid.
2017-07-03 15:07:25 +02:00
Danny Milosavljevic
be1033a334
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.
2017-07-03 10:07:59 +02:00
Ludovic Courtès
1b0f266e40
gnu: Switch guile-cairo and dependents to Guile 2.2 again.
Fixes <https://bugs.gnu.org/27551>.
Reported by Leo Famulari <leo@famulari.name>.

This reinstates the following commits:

  e3ddb1e83 * gnu: guile-cairo: Switch to Guile 2.2.
  ae5c6ef39 * gnu: guile-gnome: Update to 2.16.5.
  0fd8013fc * gnu: guile-rsvg: Update to commit 05c6a2fd.
  66b9183c4 * gnu: guile-lib: Switch to Guile 2.2.

and adds the following changes:

* gnu/bootloader/grub.scm (svg->png): Add 'package->derivation' call for
GUILE-2.2.  Pass #:guile-for-build to 'gexp->derivation'.
* gnu/build/svg.scm (svg->png): Add 'em' and 'ex' to the 'let-values'
form to account for all the values returned by
'rsvg-handle-get-dimensions', which Guile 2.2 does not truncate.
2017-07-02 22:52:30 +02:00
Danny Milosavljevic
9c0a05b31e
file-systems: iso9660-uuid->string: Use "-" as separator in the result.
* gnu/build/file-systems.scm (iso9660-uuid->string): Use "-" as separator
in the result.
2017-07-02 19:27:25 +02:00
Ludovic Courtès
a2278922fe
vm: Use 'fold2' from (guix combinators).
* gnu/build/vm.scm: Use (guix combinators).
(fold2): Remove.
2017-06-30 00:16:51 +02:00
Ludovic Courtès
a8ac4f081a
vm: Estimate the disk size by default.
* gnu/build/vm.scm (estimated-partition-size): New procedure.
* gnu/system/vm.scm (expression->derivation-in-linux-vm):
Change #:disk-image-size default to 'guess.
[builder]: When DISK-IMAGE-SIZE is 'guess, use
'estimated-partition-size' and compute and estimate of the image size.
(qemu-image): Likewise.
* guix/build/store-copy.scm (file-size, closure-size): New procedures.
* guix/scripts/system.scm (%default-options): Change 'image-size' to
'guess.
* doc/guix.texi (Building the Installation Image): Remove '--image-size'
flag from example.
(Invoking guix system): Document the image size estimate.
2017-06-30 00:16:50 +02:00
Ludovic Courtès
a2cf57e79e
vm: Display the disk and partition sizes.
* gnu/build/vm.scm (load-in-linux-vm): Add 'format' call when
MAKE-DISK-IMAGE? is true.
(initialize-partition-table): Show the size of the partitions being
created.
2017-06-30 00:16:50 +02:00
Ludovic Courtès
6efb98ed3c
vm: Fix 'load-in-linux-vm' docstring.
* gnu/build/vm.scm (load-in-linux-vm): Change default value of
  #:disk-image-size.  Update docstring to note that DISK-IMAGE-SIZE is
  in bytes.
2017-06-30 00:16:50 +02:00
Ludovic Courtès
5fa7cc5335
marionette: Factorize 'wait-for-file'.
* gnu/build/marionette.scm (wait-for-file): New procedure.
* gnu/tests/base.scm (run-mcron-test)[test](wait-for-file): Remove.
Pass second argument in 'wait-for-file' calls.
* gnu/tests/ssh.scm (run-ssh-test)[test](wait-for-file): Remove.
Pass second argument in 'wait-for-file' calls.
* gnu/tests/messaging.scm (run-xmpp-test)[test](guest-wait-for-file):
Remove.
Use 'wait-for-file' instead, with second argument.
2017-06-12 23:34:14 +02:00
Adam Van Ymeren
b53510e0d0
file-systems: Handle EIO error in 'ENOENT-safe' as well.
Trying to boot GuixSD when an audio CD is in the drive will die with an
"input/output error" when trying to read the superblock from the cd
drive.

This patch catches and warns in this case rather than dying.

* gnu/build/file-systems.scm (ENOENT-safe): Handle EIO.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-06-11 23:09:19 +02:00
Danny Milosavljevic
a81cae38ca
file-systems: Provide string->ext*-uuid, string->btrfs-uuid.
* gnu/build/file-systems.scm (string->ext2-uuid, string->ext3-uuid,
string->ext4-uuid, string->btrfs-uuid): New variables.  Export them.
2017-06-10 19:22:03 +02:00
Danny Milosavljevic
bb7cf4f533
file-systems: Provide string->iso9660-uuid.
* gnu/build/file-systems.scm (string->iso9660-uuid): New variable.  Export it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-06-09 12:30:56 +02:00
Danny Milosavljevic
c6aee77e29
file-systems: Use creation time if modification time is unset for ISO9660.
* gnu/build/file-systems.scm (iso9660-superblock-uuid): Modify.
2017-06-07 08:34:52 +02:00
Danny Milosavljevic
fb03f44bb1
file-systems: Improve error handling in the iso9660 case - fixes boot problem.
* gnu/build/file-systems.scm (read-iso9660-superblock): Modify.
2017-06-03 22:10:23 +02:00
Danny Milosavljevic
203a9455c4
file-systems: Improve error reporting.
Suggested by Chris Marusich <cmmarusich@gmail.com>.
Fixes <https://bugs.gnu.org/27143>.

* gnu/build/file-systems.scm (read-iso9660-primary-volume-descriptor):
Improve error reporting.
2017-05-31 21:13:15 +02:00
Danny Milosavljevic
cdc701ea48
gnu: build: Improve comments.
* gnu/build/file-systems.scm (iso9660-superblock-volume-name):
Add clarifying comment.
2017-05-31 19:38:49 +02:00
Ludovic Courtès
41db5a7563
activation: Change permissions on /root to #o700.
Reported by Alex Griffin <a@ajgrf.com>.
Fixes <http://bugs.gnu.org/27135>.

* gnu/build/activation.scm (add-user): When UID is zero, add 'chmod'
call.
* gnu/tests/base.scm (run-basic-test)["permissions on /root"]: New test.
2017-05-30 18:08:37 +02:00
Danny Milosavljevic
3dba9b3782
gnu: build: Improve docstrings.
* gnu/build/file-systems.scm (iso9660-superblock?,
read-iso9660-superblock, iso9660-superblock-uuid): Improve docstrings.
2017-05-27 12:35:43 +02:00
Marius Bakke
ecf5d53769
vm: Add UEFI loader to disk images.
* gnu/build/vm.scm (install-efi): New procedure.
(initialize-hard-disk): Generate EFI blob when ESP is present.
* gnu/system/vm.scm (qemu-image): Append 40MiB EFI System Partition.
2017-05-19 12:59:25 +02:00
Marius Bakke
4d415f0c3c
vm: Support creating FAT partitions.
* gnu/build/vm.scm (create-ext-file-system, create-fat-file-system): New procedures.
(format-partition): Use them. Error for unknown file systems.
* gnu/system/vm.scm (qemu-image): Include DOSFSTOOLS.
* gnu/system/linux-initrd.scm (base-initrd): Always add nls_is8859-1.ko.
2017-05-19 12:59:25 +02:00
Marius Bakke
01cc84dade
vm: Support arbitrary partition flags.
* gnu/build/vm.scm (<partition>): Change BOOTABLE? to FLAGS.
(initialize-partition-table): Pass each flag to parted.
(initialize-hard-disk): Locate boot partition.
* gnu/system/vm.scm (qemu-image): Adjust partition flags.
2017-05-19 12:59:25 +02:00
Ludovic Courtès
41f76ae08a
services: user-homes: Do not create home directories marked as no-create.
Fixes a bug whereby GuixSD would create the /nonexistent directory, from
user 'nobody', even though it has 'create-home-directory?' set to #f.

* gnu/build/activation.scm (activate-users+groups): Add comment for
\#:create-home?.
(activate-user-home)[ensure-user-home]: Skip when CREATE-HOME? is #f or
SYSTEM? is #t.
* gnu/tests/base.scm (run-basic-test)["no extra home directories"]: New
tests.
2017-05-18 10:55:16 +02:00
Mathieu Othacehe
9121ce553d
bootloader: Adapt vm to new bootloader API.
* gnu/build/install.scm (install-boot-config): New procedure.
  (install-grub): Move to (gnu bootloader grub).
* gnu/build/vm.scm (register-bootcfg-root): Rename register-grub.cfg-root and
  adjust accordingly.
  (initialize-hard-disk): Takes a bootloader-package, bootcfg, bootcfg-location and
  bootloader-installer procedure. Adjust accordingly.
* gnu/system/vm.scm (qemu-image): Adjust to initialize-hard-disk.
  (system-disk-image, system-qemu-image, system-qemu-image/shared-store):
  Adjust to qemu-image.
2017-05-16 14:41:01 +02:00
Danny Milosavljevic
06110559bb
gnu: build: file-systems: Add ISO-9660.
Fixes <https://bugs.gnu.org/26751>.

* gnu/build/file-systems.scm (iso9660-superblock?,
read-iso9660-primary-volume-descriptor, read-iso9660-superblock,
iso9660-superblock-uuid, iso9660-uuid->string,
iso9660-superblock-volume-name): New variables.
(%partition-label-readers): Add iso9660.
(%partition-uuid-readers): Add iso9660.
2017-05-03 00:18:33 +02:00
Mathieu Othacehe
07f812c404
vm: Reword grub.cfg to bootcfg.
* gnu/build/vm.scm (register-grub.cfg-root): Reword grub.cfg to bootcfg,
(initialize-hard-disk): ditto,
* gnu/system/vm.scm (system-disk-image): ditto,
(system-qemu-image): ditto,
(system-qemu-image/shared-store): ditto.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2017-04-15 14:42:15 +02:00
Ludovic Courtès
bb5cad4eb2
file-systems: Allow for bind-mounts of named sockets.
Previously a named socket such as /dev/log would fail
the 'regular-file?' test and we'd end up mkdir'ing it.

* gnu/build/file-systems.scm (regular-file?): Remove.
(mount-file-system): Change (regular-file? source)
to (not (file-is-directory? source)).
2017-04-13 00:12:42 +02:00
Mathieu Othacehe
a5e13c3be9
build: Fix compilation warnings.
* gnu/build/linux-boot.scm (define-module): Use (guix build syscalls).
* gnu/build/linux-modules.scm (define-module): Ditto.
* gnu/build/file-systems (define-module): Stop re-exporting mount, umount and
MS_* flags as this is now safe to include (guix build syscalls) instead.
(mount): Remove procedure.
(umount): Ditto.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-04-11 11:13:26 +02:00
Mathieu Othacehe
abf0880a67
vm: Add missing module.
* gnu/build/vm.scm (define-module): Use module (guix build syscalls).

It fixes the following warnings during guix build :

gnu/build/vm.scm:233:3: warning: possibly unbound variable `mount'
gnu/build/vm.scm:238:3: warning: possibly unbound variable `umount'
gnu/build/vm.scm:268:8: warning: possibly unbound variable `mount'
gnu/build/vm.scm:276:8: warning: possibly unbound variable `umount'
gnu/build/vm.scm:315:4: warning: possibly unbound variable `mount'
gnu/build/vm.scm:323:4: warning: possibly unbound variable `umount'

This was not possible until the previous commit because we had to be sure
that Guile core implementation of 'mount' and 'umount' was used in
initrd context.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-04-07 23:30:39 +02:00
Marius Bakke
4b7e5c1131
Merge branch 'master' into core-updates 2017-03-15 17:52:26 +01:00
Ludovic Courtès
5895ec8aa2
pack: Add '--symlink'.
* guix/scripts/pack.scm (self-contained-tarball): Add #:symlinks
parameter.
[build](symlink->directives): New procedure
(directives): New variable.
Add call to 'evaluate-populate-directive'.  Pass the directories among
DIRECTIVES to 'tar'.
(%default-options): Add 'symlinks'.
(%options, show-help): Add '--symlink'.
(guix-pack): Honor it.
* gnu/build/install.scm (evaluate-populate-directive): Export.
* doc/guix.texi (Invoking guix pack): Document it.
2017-03-14 17:57:27 +01:00
Ludovic Courtès
6b63c43e06
pack: Add '--localstatedir' option.
* guix/scripts/pack.scm (self-contained-tarball): Add #:localstatedir?
parameter and honor it.
(%options, show-help): Add '--localstatedir'.
(guix-pack): Honor it.
* gnu/build/install.scm (populate-single-profile-directory): Add
 #:register? parameter and honor it.
* doc/guix.texi (Binary Installation): Use '--localstatedir' in
example.
(Invoking guix pack): Document it.
2017-03-14 17:57:27 +01:00
Ludovic Courtès
e90e0fad1b
Merge branch 'master' into core-updates 2017-03-09 16:35:41 +01:00
David Craven
b0377e58c3
file-systems: Add FAT32 support.
* gnu/build/file-systems.scm (%fat32-endianness, fat32-superblock?,
read-fat32-superblock, fat32-superblock-uuid, fat32-uuid->string,
fat32-superblock-volume-name, check-fat32-file-system): New variables.
(%partition-label-readers, %partition-uuid-readers, check-file-system): Add
fat support.
(latin1->string): New variable.
(null-terminated-latin1->string): Use latin1->string.
2017-03-01 17:27:49 +01:00
Ludovic Courtès
768f0ac9dd
Merge branch 'master' into core-updates 2017-02-10 17:40:25 +01:00
Ludovic Courtès
387e175492
services: Add 'special-files-service-type'.
* gnu/build/activation.scm (activate-/bin/sh): Remove.
(activate-special-files): New procedure.
* gnu/services.scm (activation-script): Remove call to
'activate-/bin/sh'.
(special-files-service-type): New variable.
(extra-special-file): New procedure.
* gnu/services/base.scm (%base-services): Add SPECIAL-FILES-SERVICE-TYPE
instance.
* gnu/tests/base.scm (run-basic-test)[special-files]: New variables.
["special files"]: New test.
2017-02-08 16:17:05 +01:00
Ludovic Courtès
63302a4e55
Add (gnu build shepherd).
* gnu/build/shepherd.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
2017-02-07 00:08:11 +01:00
Ludovic Courtès
c90db25f4c
linux-container: Add 'container-excursion*'.
* gnu/build/linux-container.scm (container-excursion*): New procedure.
* tests/containers.scm ("container-excursion*")
("container-excursion*, same namespaces"): New tests.
2017-02-07 00:08:10 +01:00
Ludovic Courtès
36c4917c91
linux-container: Add comment on exception handling.
* gnu/build/linux-container.scm (run-container): Add note about writing
the exceptions.
2017-02-06 10:51:25 +01:00
Ludovic Courtès
168aba2978
linux-container: Do not rely on 'isatty?'.
This avoids problems where 'isatty?' return #t but 'ttyname' fails with
ENOTTY or such.

* gnu/build/linux-container.scm (mount-file-systems): Remove call of
'isatty?'.  Directly call 'ttyname' and catch 'system-error'.
2017-02-06 10:51:25 +01:00
Ludovic Courtès
cf98d342b0
activation: Set the right owner for home directories.
This fixes a regression introduced in
ae763b5b0b whereby home directories and
skeletons would be root-owned.

* gnu/build/activation.scm (copy-account-skeletons): Make 'directory' a
keyword parameter.  Add #:uid and #:gid and honor them.
[set-owner]: New procedure.
(activate-user-home): Add call to 'getpw' and 'chown'.  Pass UID and GID
to 'copy-account-skeletons'.
* gnu/tests/base.scm (run-basic-test)["skeletons in home directories"]:
Test file ownership under HOME.
2017-02-04 02:13:43 +01:00
Leo Famulari
e8c83d04e1
Merge branch 'master' into core-updates 2017-02-02 10:52:24 -05:00
Ludovic Courtès
ae763b5b0b
system: Create home directories once 'file-systems' is up.
Fixes <http://bugs.gnu.org/21108>.
Reported by Andy Patterson <ajpatter@uwaterloo.ca>
and Leo Famulari <leo@famulari.name>.

* gnu/build/activation.scm (activate-users+groups)[activate-user]: Pass
  #:create-home? #t iff CREATE-HOME? and SYSTEM?.
(activate-user-home): New procedure.
* gnu/system/shadow.scm (account-shepherd-service): New procedure.
(account-service-type)[extensions]: Add SHEPHERD-ROOT-SERVICE-TYPE
extension.
* gnu/tests/base.scm (run-basic-test)["home"]
["skeletons in home directories"]: New tests.
* gnu/tests/install.scm (%separate-home-os, %separate-home-os-source)
(%test-separate-home-os): New variables.
2017-02-01 12:36:41 +01:00
Ludovic Courtès
2fe4ceee18
file-systems: Do not read superblocks past the end of a device.
Fixes <http://bugs.gnu.org/25573>.
Reported by Alex Kost <alezost@gmail.com>.

* gnu/build/file-systems.scm (seek*): New procedure.
(read-superblock): Use it instead of 'seek' and ensure it returns
OFFSET.
2017-01-31 23:21:59 +01:00
Marius Bakke
5a64a79131
utils: Add helper method to make files writable.
* gnu/build/activation.scm (make-file-writable): Move this to ...
* guix/build/utils.scm (make-file-writable): ... here. Export it.
* guix/build/gnu-build-system.scm (strip): Use it.
2017-01-26 22:19:16 +01:00
David Craven
b1a505baf6
system: Add btrfs file system support.
* gnu/build/file-systems.scm (%btrfs-endianness, btrfs-superblock?,
  read-btrfs-superblock, btrfs-superblock-uuid,
  btrfs-superblock-volume-name, check-btrfs-file-system): New variables.
  (%paritition-label-readers, %partition-uuid-readers): Add btrfs
  readers.
* gnu/system/linux-initrd.scm (linux-modules): Add btrfs modules when a
  btrfs file-system is used.
* gnu/tests/install.scm (%btrfs-root-os %btrfs-root-os-source,
  %btrfs-root-installation-script, %test-btrfs-root-os): New system
  test.
* doc/guix.texi: Adjust accordingly.

Fixes <http://bugs.gnu.org/19280>.
2017-01-10 12:00:35 +01:00
David Craven
ab4e939c50
file-systems: Refactor file-system predicates.
* gnu/build/file-systems.scm (partition-field-reader,
  read-partition-field, %partition-label-readers,
  %partition-uuid-readers, read-partition-label, read-partition-uuid):
  New variables.
  (partition-predicate, partition-label-predicate,
  partition-uuid-predicate, luks-partition-uuid-predicate): Use
  partition field readers.
  (find-partition): New variable.
  (find-partition-by-label, find-partition-by-uuid,
  find-partition-by-luks-uuid): Use find-partition-by.
2017-01-10 12:00:05 +01:00
David Craven
26905ec8a6
file-systems: Refactor check-file-system.
* gnu/build/file-systems.scm (check-file-system): Use file-system type
  specific checker.
  (check-ext2-file-system): New variable.
2017-01-10 11:58:11 +01:00
David Craven
974e02da76
file-systems: Refactor file system detection logic.
* gnu/build/file-systems.scm (read-superblock,
  null-terminated-latin1->string): New variables.
  (sub-bytevector): Move to general section.
  (ext2-superblock?, read-ext2-superblock): New variables.
  (ext2-superblock-uuid, ext2-superblock-volume-name): Use
  sub-bytevector and null-terminated-latin1->string.
  (%ext2-sblock-magic, %ext2-sblock-creator-os, %ext2-sblock-uuid,
  %ext2-sblock-volume-name): Inline constants.
  (luks-superblock?, read-luks-header): New variables.
  (%luks-header-size, %luks-magic): Inline.
  (partition-label-predicate, partition-uuid-predicate,
  luks-partition-uuid-predicate): Use new functions.
2017-01-06 15:06:42 +01:00
Ludovic Courtès
3593e5d5c5
gnu: cross-base: Move phases to (gnu build cross-toolchain).
* gnu/packages/cross-base.scm (cross-gcc-arguments) <#:phases>: Use
'cross-gcc-build-phases', and move body cross-toolchain.scm.
(cross-gcc): Add #:imported-modules.  Add (gnu build cross-toolchain) to
 #:modules.
* gnu/build/cross-toolchain.scm: New file, with code from
'cross-gcc-arguments'.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
2016-12-07 21:52:26 +01:00
John Darrington
0c85db79f7
gnu: Allow nfs file systems to be automatically mounted.
* gnu/build/file-systems.scm (mount-file-system): Append target addr= when
mounting nfs filesystems.
2016-11-29 07:21:15 +01:00
Ludovic Courtès
d2bcf35e18
vm: Avoid needless file copy in 'load-in-linux-vm'.
Reported by Chris Webber.

* gnu/build/vm.scm (load-in-linux-vm)[image-file]: Remove.  Directly
refer to OUTPUT instead.
2016-11-28 22:58:18 +01:00
Ludovic Courtès
f7f292d359
install: Enable "cryptodisk" handling in GRUB.
This allows 'grub-install' to do the right thing when / or /boot is a
LUKS-encrypted partition.

Fixes <http://bugs.gnu.org/21843>.

* gnu/build/install.scm (install-grub): Add 'setenv' to set
'GRUB_ENABLE_CRYPTODISK'.
(wait-for-screen-text): New test.
* gnu/tests/base.scm (run-basic-test): Add #:initialization parameter
and honor it.
* gnu/tests/install.scm (%encrypted-root-os)[kernel-arguments]: Remove.
(%encrypted-root-installation-script): Pass '--uuid' to 'cryptsetup
luksFormat'.  Remove 'sed' invocation.
(enter-luks-passphrase): New procedure.
(%test-encrypted-os)[value]: Pass #:initialization to 'run-basic-test'.
2016-11-23 21:13:18 +01:00
Ludovic Courtès
fe93383350
marionette: Add 'marionette-screen-text' using OCR.
* gnu/build/marionette.scm (marionette-screen-text): New procedure.
* gnu/tests/base.scm (run-basic-test)["screen text"]: New test.
2016-11-23 21:13:18 +01:00
Ludovic Courtès
f25c9ebc80
marionette: Delay synchronization with the host's REPL.
* gnu/build/marionette.scm (<marionette>)[marionette-repl]: Rename to...
[%marionette-repl]: ... this.
(marionette-repl): New macro.
(make-marionette): Wrap last 'read' call into 'delay', making the last
argument to 'marionette' a promise of a port.
(marionette-eval): Use 'force' in 'match' clause.
2016-11-23 21:13:18 +01:00
Ludovic Courtès
ad17470551
marionette: Avoid use of SIGALRM for timeouts.
* gnu/build/marionette.scm (make-marionette)[accept*]: New procedures.
Remove calls to 'sigaction'.  Use 'accept*' instead of 'accept'.
2016-11-22 23:45:08 +01:00
Ludovic Courtès
5970e8e248
container: Pass a list of <file-system> objects as things to mount.
* gnu/build/linux-container.scm (mount-file-systems): 'mounts' is now a
list of <file-system> objects instead of a list of lists ("specs").
Add call to 'file-system->spec' as the argument to 'mount-file-system'.
(run-container, call-with-container): Adjust docstring accordingly.
* gnu/system/file-systems.scm (spec->file-system): New procedure.
* gnu/system/linux-container.scm (container-script)[script]: Call
'spec->file-system' inside gexp.
* guix/scripts/environment.scm (launch-environment/container): Remove
call to 'file-system->spec'.
* tests/containers.scm ("call-with-container, mnt namespace")
("call-with-container, mnt namespace, wrong bind mount"): Pass a list of
<file-system> objects.
2016-11-10 18:01:44 +01:00
Chris Marusich
1e17a2d5f2
install: Extract procedure: install-grub-config.
* gnu/build/install.scm (install-grub-config): New procedure.
(install-grub): Use it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-11-06 18:08:53 +01:00
ng0
de975de39b
gnu: build: file-system: Change url of LUKS specification.
* gnu/build/file-system.scm: Change url of LUKS specification.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2016-11-06 14:35:36 +02:00
Ludovic Courtès
49baaff4d2
file-systems: 'disk-partitions' detected partitions from mapped devices.
Previously, partitions of mdadm- or cryptsetup-produced block devices
would not be returned by 'disk-partitions'.

* gnu/build/file-systems.scm (disk-partitions)[last-character]: New
procedure.
[partition?]: Add 'name' parameter and rewrite.  Adjust caller.
* gnu/build/file-systems.scm (ENOENT-safe): Silently ignore ENOMEDIUM.
2016-10-27 13:48:52 +02:00
Ludovic Courtès
8ce84bf1f5
svg: Autoload Guile-RSVG and Guile-Cairo.
Fixes compilation by 'guix pull' where Guile-{RSVG,Cairo} are missing.
Reported by Efraim Flashner.

* gnu/build/svg.scm: Use 'module-autoload!' rather than 'module-use!'.
2016-10-25 13:57:28 +02:00
Ludovic Courtès
ffde82c9ec
system: grub: Use Guile-{RSVG,Cairo} instead of Inkscape + ImageMagick.
Based on a suggestion by Andy Wingo at
<https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00753.html>.

* gnu/build/svg.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/system/grub.scm (svg->png): Add #:width and #:height.  Rewrite to
use (gnu build svg).
(resize-image): Remove.
(grub-background-image): Adjust accordingly.
2016-10-25 01:21:28 +02:00
Ludovic Courtès
7fee5b5397
container: Allow 'container-excursion' to the same namespaces.
Before that, 'container-excursion' would call 'setns' even when the
target namespace is the one the caller is already in, which would fail.

* gnu/build/linux-container.scm (container-excursion): Introduce
'source' and 'target'.  Compare the result of 'readlink' on these
instead of comparing file descriptors to decide whether to call
'setns'.
* tests/containers.scm ("container-excursion, same namespace"): New test.
2016-10-19 15:54:10 +02:00
Leo Famulari
a7199b7d99
activation: Don't fail if /var/lib exists.
This is a followup to commit 6526d43ea4.

* gnu/build/activation.scm (activate-user+groups): Use mkdir-p to create
/var/lib.
2016-09-06 14:41:48 -04:00
David Craven
6526d43ea4
activation: Allow home directories to be created under /var/lib.
* gnu/build/activation.scm (activate-user+groups): Make sure /var/lib
  exists.
2016-09-06 17:48:59 +02:00
Ludovic Courtès
2ff0da0257
file-systems: Always use (guix build syscalls).
* gnu/build/file-systems.scm: Use (guix build syscalls)
unconditionally.  Override the 'mount' and 'umount' bindings
when (guile) provides them.
(MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC, MS_REMOUNT)
(MS_BIND, MS_MOVE): Remove.
* guix/build/syscalls.scm (%libc-errno-pointer): Add
'false-if-exception' around 'dynamic-func'.
2016-09-05 00:06:47 +02:00
Ludovic Courtès
334bda9a9e
tests: Make sure /var/guix/gcroots/profiles is a valid symlink.
Reported by csanchezdll@gmail.com (Carlos Sánchez de La Lama)
at <https://lists.gnu.org/archive/html/guix-devel/2016-08/msg01641.html>.

* gnu/build/install.scm (directives): Add /var/guix/gcroots/profiles
symlink.
* gnu/tests/base.scm (run-basic-test)["/var/guix/gcroots/profiles is a
valid symlink"]: New test.
2016-08-29 00:09:44 +02:00
Ludovic Courtès
eb56ee027b
system: Add 'create-home-directory?' field to <user-account>.
* gnu/system/shadow.scm (<user-account>)[create-home-directory?]: New
field.
(user-account->gexp): Serialize it.
* gnu/build/activation.scm (activate-users+groups)[activate-user]:
Update 'match-lambda' pattern accordingly.  Pass #:create-home? to
'ensure-user'.
(add-user, modify-user, ensure-user): Add #:create-home? parameter and
honor it.
* doc/guix.texi (User Accounts): Document it.
2016-08-28 15:11:18 +02:00
Ludovic Courtès
b1dd6ac55d
vm: 'qemu-command' honors its argument.
* gnu/build/vm.scm (qemu-command): Refer to SYSTEM rather than
%HOST-TYPE in the body.
2016-06-20 23:50:46 +02:00
Ludovic Courtès
c06f6db7a4
container: Gracefully report mount errors in the child process.
Fixes <http://bugs.gnu.org/23306>.

* gnu/build/linux-container.scm (run-container): Use 'socketpair'
instead of 'pipe'.  Rename 'in' to 'child' and 'out' to 'parent'.  Send
a 'ready message or an exception argument list from the child to the
parent; adjust the parent accordingly.
* tests/containers.scm ("call-with-container, mnt namespace, wrong bind
mount"): New test.
* tests/guix-environment-container.sh: Add test with
--expose=/does-not-exist.
2016-05-31 00:11:04 +02:00
Ludovic Courtès
4c14d4eaa7
container: Gracefully handle failure to set up user namespaces.
* gnu/build/linux-container.scm (run-container): Exit when the parent
process doesn't say 'ready.
2016-05-31 00:11:04 +02:00
Ludovic Courtès
957afcae3c
Add (gnu tests) and (gnu build marionette).
* gnu/build/marionette.scm, gnu/tests.scm: New files.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add them.
* gnu/system/vm.scm (common-qemu-options): Remove '-serial stdio'.
2016-05-04 23:35:55 +02:00
Ludovic Courtès
a1ccefaa12 file-systems: Add 'find-partition-by-luks-uuid'.
* gnu/build/file-systems.scm (%luks-endianness, %luks-header-size): New
macros.
(%luks-magic): New variable.
(sub-bytevector, read-luks-header, luks-header-uuid): New procedures.
(partition-predicate): Add 'read' parameter; wrap it with 'ENOENT-safe'.
Use it instead of 'read-ext2-superblock*'.
(read-ext2-superblock*): Remove.
(partition-label-predicate, partition-uuid-predicate): Pass
'read-ext2-superblock' as the first argument.
(partition-luks-uuid-predicate): New variable.
(find-partition-by-luks-uuid): New procedure.
2016-04-17 01:23:52 +02:00
Ludovic Courtès
2447335625 file-systems: Separate ENOENT catching from ext2 superblock reads.
* gnu/build/file-systems.scm (ENOENT-safe): New procedure.
(read-ext2-superblock*): Rewrite in terms of it.
2016-04-17 01:23:52 +02:00
Ludovic Courtès
2fa909b27b activation: Copy account skeletons silently.
* gnu/build/activation.scm (copy-account-skeletons): Pass #:log to
'copy-recursively'.
2016-03-24 22:47:15 +01:00
Ludovic Courtès
4e8b7502e3 system: Allow account skeletons to be directories.
* gnu/system/shadow.scm (skeleton-directory): Use 'copy-recursively'
instead of 'copy-file'.
* gnu/build/activation.scm (copy-account-skeletons): Likewise.
2016-03-20 15:02:38 +01:00
Ricardo Wurmus
e1a5615875 build: reset-timestamps: Include directories.
* guix/build/install.scm (reset-timestamps): Reset timestamps of
  directories as well.
2016-03-14 12:36:49 +01:00