Commit Graph

132 Commits

Author SHA1 Message Date
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