Skip to content

Commit

Permalink
Revert "prepare-root: Make leftover /sysroot immutable"
Browse files Browse the repository at this point in the history
This reverts commit 1d4dc03.
  • Loading branch information
ruihe774 committed Dec 20, 2024
1 parent c7caee9 commit 124035b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
3 changes: 1 addition & 2 deletions Makefile-switchroot.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ CLEANFILES += ostree-prepare-root
else
ostree_boot_PROGRAMS += ostree-prepare-root
ostree_prepare_root_CFLAGS += $(AM_CFLAGS) -Isrc/switchroot -I$(srcdir)/src/libostree -I$(srcdir)/src/libotcore -I$(srcdir)/src/libotutil
ostree_prepare_root_SOURCES += src/switchroot/ostree-prepare-root.c \
src/libostree/ostree-linuxfsutil.c
ostree_prepare_root_SOURCES += src/switchroot/ostree-prepare-root.c
ostree_prepare_root_CPPFLAGS += $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_DEP_CRYPTO_CFLAGS) -I $(srcdir)/libglnx
ostree_prepare_root_LDADD += $(AM_LDFLAGS) $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_DEP_CRYPTO_LIBS) libotcore.la libotutil.la libglnx.la
endif # BUILDOPT_USE_STATIC_COMPILER
Expand Down
17 changes: 0 additions & 17 deletions src/switchroot/ostree-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
#include <libcomposefs/lcfs-writer.h>
#endif

#include "ostree-linuxfsutil.h"
#include "ostree-mount-util.h"

static bool
Expand Down Expand Up @@ -785,22 +784,6 @@ main (int argc, char *argv[])
/* Unmount /sysroot */
if (umount2 ("sysroot", MNT_DETACH) < 0)
err (EXIT_FAILURE, "failed to unmount /sysroot");

/* Attempt to make the leftover empty /sysroot immutable.
* This is to prevent accidental modification when root.transient is enabled.
*/
do
{
g_autoptr (GError) local_error = NULL;
glnx_autofd int fd = -1;
if (!glnx_opendirat (AT_FDCWD, "sysroot", TRUE, &fd, &local_error))
err (EXIT_FAILURE, "failed to open /sysroot");
/* It's funny that we need to first touch it to move it to upper layer */
if (futimens (fd, NULL) < 0)
break;
if (!_ostree_linuxfs_fd_alter_immutable_flag (fd, TRUE, NULL, &local_error))
break;
} while (FALSE);
}
else if (sysroot_readonly)
{
Expand Down

0 comments on commit 124035b

Please sign in to comment.