guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: system: Clean /tmp and /var/run during early boot.


From: Mark H. Weaver
Subject: 01/01: system: Clean /tmp and /var/run during early boot.
Date: Fri, 10 Apr 2015 13:25:18 +0000

mhw pushed a commit to branch master
in repository guix.

commit 5e738ac224c7aea948773e89235dc1418bff448e
Author: Mark H Weaver <address@hidden>
Date:   Tue Feb 24 23:54:29 2015 -0500

    system: Clean /tmp and /var/run during early boot.
    
    * gnu/system.scm (operating-system-boot-script): Clean out /tmp and
      /var/run before activating the system.
---
 gnu/system.scm |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index ece61ad..a91c713 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015 Mark H Weaver <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -695,6 +696,20 @@ we're running in the final root."
                        (dmd-conf (dmd-configuration-file services)))
     (gexp->file "boot"
                 #~(begin
+                    (use-modules (guix build utils))
+
+                    ;; Clean out /tmp and /var/run.
+                    ;;
+                    ;; XXX This needs to happen before service activations, so
+                    ;; it has to be here, but this also implicitly assumes
+                    ;; that /tmp and /var/run are on the root partition.
+                    (false-if-exception (delete-file-recursively "/tmp"))
+                    (false-if-exception (delete-file-recursively "/var/run"))
+                    (false-if-exception (mkdir "/tmp"))
+                    (false-if-exception (chmod "/tmp" #o1777))
+                    (false-if-exception (mkdir "/var/run"))
+                    (false-if-exception (chmod "/var/run" #o755))
+
                     ;; Activate the system.
                     ;; TODO: Use 'load-compiled'.
                     (primitive-load #$activate)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]