[bug#73494,v2,2/3] services: cleanup: Make /var/run a symlink of /run.
Commit Message
* gnu/services.scm (cleanup-gexp): Make /var/run a symlink of /run.
* doc/guix.texi (File Systems): Document it.
* gnu/system/file-systems.scm (file-system-mapping->bind-mount): Use
canonicalized source path.
* gnu/services/dbus.scm (dbus-activation): Adjust accordingly.
Change-Id: I7b94d3e2fe1bef66f435e84bc77f32311dddd0ce
---
doc/guix.texi | 3 +++
gnu/services.scm | 5 +++--
gnu/services/dbus.scm | 31 -------------------------------
gnu/system/file-systems.scm | 2 +-
4 files changed, 7 insertions(+), 34 deletions(-)
@@ -18231,6 +18231,9 @@ File Systems
@defvar %runtime-variable-data
This file system is mounted as @file{/run} and contains system
information data describing the system since it was booted.
+
+Additionally, another directory with same role, @file{/var/run}, is
+implemented as a symlink to @file{/run}.
@end defvar
@defvar %binary-format-file-system
@@ -668,8 +668,9 @@ (define (cleanup-gexp _)
;; hence the 'chmod' calls.
(mkdir "/tmp" #o1777)
(chmod "/tmp" #o1777)
- (mkdir "/var/run" #o755)
- (chmod "/var/run" #o755))))))
+ ;; /run is implemented as tmpfs mounted at early boot.
+ (mkdir-p "/var")
+ (symlink "/run" "/var/run"))))))
(define cleanup-service-type
;; Service that cleans things up in /tmp and similar.
@@ -190,37 +190,6 @@ (define (dbus-activation config)
;; world-readable.
(mkdir-p/perms "/run/dbus" user #o755))
- (catch 'system-error
- (lambda ()
- (symlink "/run/dbus" "/var/run/dbus"))
- (lambda args
- (let ((errno (system-error-errno args)))
- (cond
- ((= errno EEXIST)
- (let ((existing-name
- (false-if-exception
- (readlink "/var/run/dbus"))))
- (unless (equal? existing-name "/run/dbus")
- ;; Move the content of /var/run/dbus to /run/dbus, and
- ;; retry.
- (let ((dir (opendir "/var/run/dbus")))
- (let loop ((next (readdir dir)))
- (cond
- ((eof-object? next) (closedir dir))
- ((member next '("." "..")) (loop (readdir dir)))
- (else
- (begin
- (rename-file (string-append "/var/run/dbus/" next)
- (string-append "/run/dbus/" next))
- (loop (readdir dir)))))))
- (rmdir "/var/run/dbus")
- (symlink "/run/dbus" "/var/run/dbus"))))
- (else
- (format (current-error-port)
- "Failed to symlink /run/dbus to /var/run/dbus: ~s~%"
- (strerror errno))
- (error "cannot create /var/run/dbus"))))))
-
(unless (file-exists? "/etc/machine-id")
(format #t "creating /etc/machine-id...~%")
(invoke (string-append #$(dbus-configuration-dbus config)
@@ -594,7 +594,7 @@ (define (file-system-mapping->bind-mount mapping)
(($ <file-system-mapping> source target writable?)
(file-system
(mount-point target)
- (device source)
+ (device (canonicalize-path source))
(type "none")
(flags (if writable?
'(bind-mount)