diff options
| author | Janneke Nieuwenhuizen <janneke@gnu.org> | 2023-05-30 18:07:17 +0200 |
|---|---|---|
| committer | Janneke Nieuwenhuizen <janneke@gnu.org> | 2024-10-15 11:13:48 +0200 |
| commit | 7c93145d9e027cb571bf7634192dfae5468ecde2 (patch) | |
| tree | f46eccfce9f3d8d09973badfbd25aa4c82d5b362 /gnu/build | |
| parent | 85130e1a752275aaa4030124e3d38ab502c62e0b (diff) | |
hurd-boot: Support system init: Create essential device nodes.
* gnu/build/hurd-boot.scm (make-hurd-device-nodes): Cater for existing
directories (dev, servers).
(set-hurd-device-translators): Remove /servers/socket/1, that is created by
libexec/console-run. Cater for nonexistent /dev/console.
(boot-hurd-system): Call make-hurd-device-nodes on initial run.
Diffstat (limited to 'gnu/build')
| -rw-r--r-- | gnu/build/hurd-boot.scm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm index 4407284acb9..daf4fb41abc 100644 --- a/gnu/build/hurd-boot.scm +++ b/gnu/build/hurd-boot.scm | |||
| @@ -79,13 +79,13 @@ Return the value associated with OPTION, or #f on failure." | |||
| 79 | (define (scope dir) | 79 | (define (scope dir) |
| 80 | (string-append root (if (string-suffix? "/" root) "" "/") dir)) | 80 | (string-append root (if (string-suffix? "/" root) "" "/") dir)) |
| 81 | 81 | ||
| 82 | (mkdir (scope "dev")) | 82 | (mkdir-p (scope "dev")) |
| 83 | ;; Don't create /dev/null etc just yet; the store | 83 | ;; Don't create /dev/null etc just yet; the store |
| 84 | ;; messes-up the permission bits. | 84 | ;; messes-up the permission bits. |
| 85 | ;; Don't create /dev/console, /dev/vcs, etc.: they are created by | 85 | ;; Don't create /dev/console, /dev/vcs, etc.: they are created by |
| 86 | ;; console-run on first boot. | 86 | ;; console-run on first boot. |
| 87 | 87 | ||
| 88 | (mkdir (scope "servers")) | 88 | (mkdir-p (scope "servers")) |
| 89 | (for-each (lambda (file) | 89 | (for-each (lambda (file) |
| 90 | (call-with-output-file (scope (string-append "servers/" file)) | 90 | (call-with-output-file (scope (string-append "servers/" file)) |
| 91 | (lambda (port) | 91 | (lambda (port) |
| @@ -100,7 +100,8 @@ Return the value associated with OPTION, or #f on failure." | |||
| 100 | "kill" | 100 | "kill" |
| 101 | "suspend")) | 101 | "suspend")) |
| 102 | 102 | ||
| 103 | (mkdir (scope "servers/socket")) | 103 | (mkdir-p (scope "servers/socket")) |
| 104 | |||
| 104 | ;; Don't create /servers/socket/1 & co: runsystem does that on first boot. | 105 | ;; Don't create /servers/socket/1 & co: runsystem does that on first boot. |
| 105 | 106 | ||
| 106 | ;; TODO: Set the 'gnu.translator' extended attribute for passive translator | 107 | ;; TODO: Set the 'gnu.translator' extended attribute for passive translator |
| @@ -279,7 +280,8 @@ set." | |||
| 279 | (for-each scope-set-translator servers) | 280 | (for-each scope-set-translator servers) |
| 280 | (mkdir* "dev/vcs/1") | 281 | (mkdir* "dev/vcs/1") |
| 281 | (mkdir* "dev/vcs/2") | 282 | (mkdir* "dev/vcs/2") |
| 282 | (rename-file (scope "dev/console") (scope "dev/console-")) | 283 | (when (file-exists? (scope "dev/console")) |
| 284 | (rename-file (scope "dev/console") (scope "dev/console-"))) | ||
| 283 | (for-each scope-set-translator devices) | 285 | (for-each scope-set-translator devices) |
| 284 | 286 | ||
| 285 | (false-if-EEXIST (symlink "/dev/random" (scope "dev/urandom"))) | 287 | (false-if-EEXIST (symlink "/dev/random" (scope "dev/urandom"))) |
| @@ -326,6 +328,10 @@ XXX TODO: use Linux xattr/setxattr to remove (settrans in) /libexec/RUNSYSTEM | |||
| 326 | (let ((hurd/hurd (readlink* (string-append system "/profile/hurd")))) | 328 | (let ((hurd/hurd (readlink* (string-append system "/profile/hurd")))) |
| 327 | (symlink hurd/hurd "/hurd")) | 329 | (symlink hurd/hurd "/hurd")) |
| 328 | 330 | ||
| 331 | (unless (file-exists? "/servers/startup") | ||
| 332 | (format #t "Creating essential device nodes...\n") | ||
| 333 | (make-hurd-device-nodes)) | ||
| 334 | |||
| 329 | (format #t "Setting-up essential translators...\n") | 335 | (format #t "Setting-up essential translators...\n") |
| 330 | (setenv "PATH" (string-append system "/profile/bin")) | 336 | (setenv "PATH" (string-append system "/profile/bin")) |
| 331 | (set-hurd-device-translators) | 337 | (set-hurd-device-translators) |
