Bug#851284: apt tmpfiles.d configuration
Package: apt
Version: 1.4~beta3
Tags: patch
Although apt creates all the directories in /var on install, it's
entirely possible that they won't exist at runtime. This is most likely
to happen on a stateless[1] systems, but could also happen if an
administrator wipes the directories in /var when cleaning up.
Provide a tmpfiles.d configuration to create these directories at boot
time on systemd systems. This will help ensure the directories always
exist so apt doesn't fail with missing directory errors.
1. http://0pointer.net/blog/projects/stateless.html
--
Dan Nicholson | +1.206.437.0833 | Endless
From 74ae3e2edb9549843cdbef1c7827b41333452830 Mon Sep 17 00:00:00 2001
From: Dan Nicholson <nicholson@endlessm.com>
Date: Fri, 13 Jan 2017 11:00:20 -0600
Subject: [PATCH] Provide tmpfiles.d configuration for stateless systems
Although apt creates all the directories in /var on install, it's
entirely possible that they won't exist at runtime. This is most likely
to happen on a stateless[1] systems, but could also happen if an
administrator wipes the directories in /var when cleaning up.
Provide a tmpfiles.d configuration to create these directories at boot
time on systemd systems. This will help ensure the directories always
exist so apt doesn't fail with missing directory errors.
1. http://0pointer.net/blog/projects/stateless.html
---
CMakeLists.txt | 5 +++++
apt-tmpfiles.conf | 7 +++++++
debian/apt.install | 1 +
3 files changed, 13 insertions(+)
create mode 100644 apt-tmpfiles.conf
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0afc73c..35c4eb3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -228,3 +228,8 @@ install_empty_directories(
${STATE_DIR}/periodic
${LOG_DIR}
)
+
+# Install tmpfiles.d configuration for stateless (empty /var) systems
+install(FILES apt-tmpfiles.conf
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d"
+ RENAME apt.conf)
diff --git a/apt-tmpfiles.conf b/apt-tmpfiles.conf
new file mode 100644
index 0000000..cfc58a5
--- /dev/null
+++ b/apt-tmpfiles.conf
@@ -0,0 +1,7 @@
+# See tmpfiles.d(5) for details
+
+# Type Path Mode UID GID Age Argument
+d /var/cache/apt/archives/partial - - - -
+d /var/lib/apt/lists/partial - - - -
+d /var/lib/apt/mirrors/partial - - - -
+d /var/lib/apt/periodic - - - -
diff --git a/debian/apt.install b/debian/apt.install
index 2c21878..dcf4cf6 100644
--- a/debian/apt.install
+++ b/debian/apt.install
@@ -15,6 +15,7 @@ usr/lib/apt/methods/
usr/lib/apt/planners/dump
usr/lib/apt/solvers/dump
usr/lib/dpkg/methods/apt/
+usr/lib/tmpfiles.d/apt.conf
usr/share/bash-completion/completions/
usr/share/doc/apt
usr/share/locale/*/*/apt.mo
--
2.1.4
Reply to: