2015-03-23 11:17:58 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2014 Red Hat, Inc
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2016-07-29 18:27:49 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2015-03-23 11:17:58 +00:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Alexander Larsson <alexl@redhat.com>
|
|
|
|
*/
|
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
#ifndef __FLATPAK_RUN_H__
|
|
|
|
#define __FLATPAK_RUN_H__
|
2015-02-13 09:29:41 +00:00
|
|
|
|
2015-05-22 13:36:52 +00:00
|
|
|
#include "libglnx/libglnx.h"
|
2016-05-06 16:03:47 +00:00
|
|
|
#include "dbus-proxy/flatpak-proxy.h"
|
|
|
|
#include "flatpak-common-types.h"
|
2016-05-27 14:30:13 +00:00
|
|
|
#include "flatpak-utils.h"
|
2015-05-22 13:36:52 +00:00
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
gboolean flatpak_run_in_transient_unit (const char *app_id,
|
2016-05-06 14:03:27 +00:00
|
|
|
GError **error);
|
2015-03-04 13:40:17 +00:00
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
#define FLATPAK_METADATA_GROUP_CONTEXT "Context"
|
|
|
|
#define FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY "Session Bus Policy"
|
|
|
|
#define FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY "System Bus Policy"
|
|
|
|
#define FLATPAK_METADATA_GROUP_ENVIRONMENT "Environment"
|
|
|
|
#define FLATPAK_METADATA_KEY_SHARED "shared"
|
|
|
|
#define FLATPAK_METADATA_KEY_SOCKETS "sockets"
|
|
|
|
#define FLATPAK_METADATA_KEY_FILESYSTEMS "filesystems"
|
|
|
|
#define FLATPAK_METADATA_KEY_PERSISTENT "persistent"
|
|
|
|
#define FLATPAK_METADATA_KEY_DEVICES "devices"
|
2016-09-05 19:22:20 +00:00
|
|
|
#define FLATPAK_METADATA_KEY_FEATURES "features"
|
2015-05-22 13:36:52 +00:00
|
|
|
|
2016-05-27 14:30:13 +00:00
|
|
|
extern const char *flatpak_context_sockets[];
|
|
|
|
extern const char *flatpak_context_devices[];
|
2016-09-05 19:22:20 +00:00
|
|
|
extern const char *flatpak_context_features[];
|
2016-05-27 14:30:13 +00:00
|
|
|
extern const char *flatpak_context_shares[];
|
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
FlatpakContext *flatpak_context_new (void);
|
|
|
|
void flatpak_context_free (FlatpakContext *context);
|
|
|
|
void flatpak_context_merge (FlatpakContext *context,
|
|
|
|
FlatpakContext *other);
|
|
|
|
GOptionGroup *flatpak_context_get_options (FlatpakContext *context);
|
2016-05-27 14:30:13 +00:00
|
|
|
void flatpak_context_complete (FlatpakContext *context,
|
|
|
|
FlatpakCompletion *completion);
|
2016-05-06 14:37:47 +00:00
|
|
|
gboolean flatpak_context_load_metadata (FlatpakContext *context,
|
|
|
|
GKeyFile *metakey,
|
|
|
|
GError **error);
|
|
|
|
void flatpak_context_save_metadata (FlatpakContext *context,
|
|
|
|
GKeyFile *metakey);
|
|
|
|
void flatpak_context_allow_host_fs (FlatpakContext *context);
|
|
|
|
void flatpak_context_set_session_bus_policy (FlatpakContext *context,
|
|
|
|
const char *name,
|
|
|
|
FlatpakPolicy policy);
|
|
|
|
void flatpak_context_set_system_bus_policy (FlatpakContext *context,
|
|
|
|
const char *name,
|
|
|
|
FlatpakPolicy policy);
|
2016-05-26 10:23:48 +00:00
|
|
|
void flatpak_context_to_args (FlatpakContext *context,
|
|
|
|
GPtrArray *args);
|
2015-05-22 13:36:52 +00:00
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakContext, flatpak_context_free)
|
2015-05-22 13:36:52 +00:00
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
gboolean flatpak_run_add_extension_args (GPtrArray *argv_array,
|
2016-05-06 14:03:27 +00:00
|
|
|
GKeyFile *metakey,
|
|
|
|
const char *full_ref,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2016-05-06 14:37:47 +00:00
|
|
|
void flatpak_run_add_environment_args (GPtrArray *argv_array,
|
2016-05-11 13:14:11 +00:00
|
|
|
GArray *fd_array,
|
2016-05-06 14:37:47 +00:00
|
|
|
char ***envp_p,
|
|
|
|
GPtrArray *session_bus_proxy_argv,
|
|
|
|
GPtrArray *system_bus_proxy_argv,
|
|
|
|
const char *app_id,
|
|
|
|
FlatpakContext *context,
|
|
|
|
GFile *app_id_dir);
|
|
|
|
char ** flatpak_run_get_minimal_env (gboolean devel);
|
|
|
|
char ** flatpak_run_apply_env_default (char **envp);
|
|
|
|
char ** flatpak_run_apply_env_appid (char **envp,
|
2016-05-06 14:03:27 +00:00
|
|
|
GFile *app_dir);
|
2016-05-06 14:37:47 +00:00
|
|
|
char ** flatpak_run_apply_env_vars (char **envp,
|
|
|
|
FlatpakContext *context);
|
2015-02-13 09:33:36 +00:00
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
GFile *flatpak_get_data_dir (const char *app_id);
|
|
|
|
GFile *flatpak_ensure_data_dir (const char *app_id,
|
2016-05-06 14:03:27 +00:00
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2015-02-19 21:52:01 +00:00
|
|
|
|
2015-12-07 11:27:53 +00:00
|
|
|
typedef enum {
|
2016-05-25 14:38:50 +00:00
|
|
|
FLATPAK_RUN_FLAG_DEVEL = (1 << 0),
|
|
|
|
FLATPAK_RUN_FLAG_BACKGROUND = (1 << 1),
|
|
|
|
FLATPAK_RUN_FLAG_LOG_SESSION_BUS = (1 << 2),
|
|
|
|
FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS = (1 << 3),
|
|
|
|
FLATPAK_RUN_FLAG_NO_SESSION_HELPER = (1 << 4),
|
2016-05-06 14:37:47 +00:00
|
|
|
} FlatpakRunFlags;
|
2015-12-07 11:27:53 +00:00
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
gboolean flatpak_run_setup_base_argv (GPtrArray *argv_array,
|
2016-05-11 13:33:49 +00:00
|
|
|
GArray *fd_array,
|
2016-05-06 14:37:47 +00:00
|
|
|
GFile *runtime_files,
|
|
|
|
GFile *app_id_dir,
|
|
|
|
const char *arch,
|
|
|
|
FlatpakRunFlags flags,
|
|
|
|
GError **error);
|
2016-09-02 12:01:44 +00:00
|
|
|
gboolean flatpak_run_add_app_info_args (GPtrArray *argv_array,
|
|
|
|
GArray *fd_array,
|
|
|
|
GFile *app_files,
|
2016-09-07 10:19:13 +00:00
|
|
|
GFile *runtime_files,
|
2016-09-02 12:01:44 +00:00
|
|
|
const char *app_id,
|
2016-09-07 10:31:56 +00:00
|
|
|
const char *app_branch,
|
2016-09-02 12:01:44 +00:00
|
|
|
const char *runtime_ref,
|
|
|
|
FlatpakContext *final_app_context,
|
|
|
|
GError **error);
|
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
gboolean flatpak_run_app (const char *app_ref,
|
|
|
|
FlatpakDeploy *app_deploy,
|
|
|
|
FlatpakContext *extra_context,
|
|
|
|
const char *custom_runtime,
|
|
|
|
const char *custom_runtime_version,
|
|
|
|
FlatpakRunFlags flags,
|
|
|
|
const char *custom_command,
|
|
|
|
char *args[],
|
|
|
|
int n_args,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error);
|
2015-12-07 11:27:53 +00:00
|
|
|
|
|
|
|
|
2016-05-06 14:37:47 +00:00
|
|
|
#endif /* __FLATPAK_RUN_H__ */
|