On Thu, 24 Mar 2022 18:55:59 +0100 Marco d'Itri wrote:
> > For Debian, I think usrmerge.postinst should skip conversion in case
> > overlayfs is used (without error, but possibly a warning message). With
> I agree. The base image can be trivially converted anyway by unpacking 
> it, using chroot, installing usrmerge and then repacking the image.

I also wrote a patch for this some time ago, so you can choose between
mine and Luca's ;-)

Ansgar

From 84701e070c09eceb10d2691085aa32483469ab35 Mon Sep 17 00:00:00 2001
From: Ansgar <ans...@debian.org>
Date: Tue, 29 Mar 2022 20:00:43 +0200
Subject: [PATCH 1/2] postinst: prepare for other filesystem checks

---
 debian/usrmerge.postinst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/debian/usrmerge.postinst b/debian/usrmerge.postinst
index 564954e..e8444e3 100644
--- a/debian/usrmerge.postinst
+++ b/debian/usrmerge.postinst
@@ -1,9 +1,9 @@
 #!/bin/sh -e
 
-is_nfs() {
-  local fs_type="$(stat --file-system --format=%T "$1" 2> /dev/null)"
+is_fs() {
+  local fs_type="$(stat --file-system --format=%T "$2" 2> /dev/null)"
 
-  if [ "$fs_type" = 'nfs' ]; then return 0; fi
+  if [ "$fs_type" = "${1}" ]; then return 0; fi
   return 1
 }
 
@@ -11,7 +11,7 @@ maybe_convert() {
   # do not try to run the program if the system has already been converted
   [ "$(readlink -f /lib)" != '/usr/lib' ] || return 0
 
-  if is_nfs / || is_nfs /usr; then
+  if is_fs nfs / || is_fs nfs /usr; then
     cat << 'END' >&2
 
 Warning: NFS detected, /usr/lib/usrmerge/convert-usrmerge will not be run
-- 
2.35.1

From 5fd5ba7c19e5031f75e0aa412a1ceda93c447677 Mon Sep 17 00:00:00 2001
From: Ansgar <ans...@debian.org>
Date: Tue, 29 Mar 2022 20:05:13 +0200
Subject: [PATCH 2/2] postinst: skip conversion on overlayfs

---
 debian/usrmerge.postinst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/debian/usrmerge.postinst b/debian/usrmerge.postinst
index e8444e3..fff77c8 100644
--- a/debian/usrmerge.postinst
+++ b/debian/usrmerge.postinst
@@ -17,6 +17,16 @@ maybe_convert() {
 Warning: NFS detected, /usr/lib/usrmerge/convert-usrmerge will not be run
 automatically. See #842145 for details.
 
+END
+    return 0
+  fi
+
+  if is_fs overlayfs / || is_fs overlayfs /usr; then
+    cat << 'END' >&2
+
+Warning: overlayfs detected, /usr/lib/usrmerge/convert-usrmerge will not
+be run automatically. See #1008202 for details.
+
 END
     return 0
   fi
-- 
2.35.1

Reply via email to