$(NULL)
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/composefs -I$(srcdir)/src/libotutil -I$(srcdir)/src/libotcore -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
+ -I$(srcdir)/src/switchroot \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_CRYPTO_CFLAGS) \
-fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern' \
-DPKGLIBEXECDIR=\"$(pkglibexecdir)\"
G_BEGIN_DECLS
-gboolean _ostree_impl_system_generator (const char *ostree_cmdline, const char *normal_dir,
- const char *early_dir, const char *late_dir,
- GError **error);
+gboolean _ostree_impl_system_generator (const char *normal_dir, const char *early_dir,
+ const char *late_dir, GError **error);
typedef struct
{
- gboolean (*ostree_system_generator) (const char *ostree_cmdline, const char *normal_dir,
- const char *early_dir, const char *late_dir, GError **error);
+ gboolean (*ostree_system_generator) (const char *normal_dir, const char *early_dir,
+ const char *late_dir, GError **error);
gboolean (*ostree_generate_grub2_config) (OstreeSysroot *sysroot, int bootversion, int target_fd,
GCancellable *cancellable, GError **error);
gboolean (*ostree_static_delta_dump) (OstreeRepo *repo, const char *delta_id,
#include "ostree-cmd-private.h"
#include "ostree-core-private.h"
+#include "ostree-mount-util.h"
#include "ostree-sysroot-private.h"
#include "ostree.h"
/* Implementation of ostree-system-generator */
gboolean
-_ostree_impl_system_generator (const char *ostree_cmdline, const char *normal_dir,
- const char *early_dir, const char *late_dir, GError **error)
+_ostree_impl_system_generator (const char *normal_dir, const char *early_dir, const char *late_dir,
+ GError **error)
{
+ /* We conflict with the magic ostree-mount-deployment-var file for ostree-prepare-root.
+ * If this file is present, we have nothing to do! */
+ if (unlinkat (AT_FDCWD, INITRAMFS_MOUNT_VAR, 0) == 0)
+ return TRUE;
+
+ /* If we're installed on a system which isn't using OSTree for boot (e.g.
+ * package installed as a dependency for flatpak or whatever), silently
+ * exit so that we don't error, but at the same time work where switchroot
+ * is PID 1 (and so hasn't created /run/ostree-booted).
+ */
+ autofree char *ostree_cmdline = read_proc_cmdline_key ("ostree");
+ if (!ostree_cmdline)
+ return TRUE;
+
if (!require_internal_units (normal_dir, early_dir, late_dir, error))
return FALSE;
if (!fstab_generator (ostree_cmdline, normal_dir, early_dir, late_dir, error))
#include <libglnx.h>
#include "ostree-cmd-private.h"
-#include "ostree-mount-util.h"
static const char *arg_dest = "/tmp";
static const char *arg_dest_late = "/tmp";
int
main (int argc, char *argv[])
{
- /* We conflict with the magic ostree-mount-deployment-var file for ostree-prepare-root */
- {
- struct stat stbuf;
- if (fstatat (AT_FDCWD, INITRAMFS_MOUNT_VAR, &stbuf, 0) == 0)
- {
- if (unlinkat (AT_FDCWD, INITRAMFS_MOUNT_VAR, 0) < 0)
- err (EXIT_FAILURE, "Can't unlink " INITRAMFS_MOUNT_VAR);
- exit (EXIT_SUCCESS);
- }
- }
-
if (argc > 1 && argc != 4)
errx (EXIT_FAILURE, "This program takes three or no arguments");
if (argc > 3)
arg_dest_late = argv[3];
- /* If we're installed on a system which isn't using OSTree for boot (e.g.
- * package installed as a dependency for flatpak or whatever), silently
- * exit so that we don't error, but at the same time work where switchroot
- * is PID 1 (and so hasn't created /run/ostree-booted).
- */
- autofree char *ostree_cmdline = read_proc_cmdline_key ("ostree");
- if (!ostree_cmdline)
- exit (EXIT_SUCCESS);
-
{
g_autoptr (GError) local_error = NULL;
- if (!ostree_cmd__private__ ()->ostree_system_generator (ostree_cmdline, arg_dest, NULL,
- arg_dest_late, &local_error))
+ if (!ostree_cmd__private__ ()->ostree_system_generator (arg_dest, NULL, arg_dest_late,
+ &local_error))
errx (EXIT_FAILURE, "%s", local_error->message);
}