forked from Mirrors/flatpak-builder
Change /self to /app
This changes the application prefix to /app, which has the advantage of being the same length as /usr. This may help making some packages relocatable. We make /self a symlink to /app for now, to keep existing images work, but at some point we will probably remove this.tingping/wmclass
parent
3a68d242a6
commit
8ffacee14c
|
@ -48,7 +48,7 @@
|
|||
The sdk that is specfied in the <filename>metadata</filename> file
|
||||
in the directory is mounted at <filename>/usr</filename> and the
|
||||
<filename>files</filename> and <filename>var</filename> subdirectories
|
||||
are mounted at <filename>/self</filename> and <filename>/var</filename>,
|
||||
are mounted at <filename>/app</filename> and <filename>/var</filename>,
|
||||
respectively. They are writable, and their contents are preserved between
|
||||
build commands, to allow accumulating build artifacts there.
|
||||
</para>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
xdg-app creates a sandboxed environment for the application to run in
|
||||
by mounting the right runtime at <filename>/usr</filename> and a writable
|
||||
directory at <filename>/var</filename>, whose content is preserved between
|
||||
application runs. The application itself is mounted at <filename>/self</filename>.
|
||||
application runs. The application itself is mounted at <filename>/app</filename>.
|
||||
</para>
|
||||
<para>
|
||||
The details of the sandboxed environment are controlled by the application
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -d /self/exports/share/applications \); then
|
||||
exec update-desktop-database -q /self/exports/share/applications
|
||||
if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -d /app/exports/share/applications \); then
|
||||
exec update-desktop-database -q /app/exports/share/applications
|
||||
fi
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d /self/exports/share/icons/hicolor \); then
|
||||
cp /usr/share/icons/hicolor/index.theme /self/exports/share/icons/hicolor/
|
||||
for dir in /self/exports/share/icons/*; do
|
||||
if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d /app/exports/share/icons/hicolor \); then
|
||||
cp /usr/share/icons/hicolor/index.theme /app/exports/share/icons/hicolor/
|
||||
for dir in /app/exports/share/icons/*; do
|
||||
if test -f $dir/index.theme; then
|
||||
if ! gtk-update-icon-cache --quiet $dir; then
|
||||
echo "Failed to run gtk-update-icon-cache for $dir"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -d /self/exports/share/mime/packages \); then
|
||||
exec update-mime-database /self/exports/share/mime
|
||||
if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -d /app/exports/share/mime/packages \); then
|
||||
exec update-mime-database /app/exports/share/mime
|
||||
fi
|
||||
|
|
|
@ -66,7 +66,7 @@ add_extension_arg (const char *directory,
|
|||
|
||||
is_app = strcmp (type, "app") == 0;
|
||||
|
||||
full_directory = g_build_filename (is_app ? "/self" : "/usr", directory, NULL);
|
||||
full_directory = g_build_filename (is_app ? "/app" : "/usr", directory, NULL);
|
||||
|
||||
extension_ref = g_build_filename (type, extension, arch, branch, NULL);
|
||||
deploy = xdg_app_find_deploy_dir_for_ref (extension_ref, cancellable, NULL);
|
||||
|
|
|
@ -298,11 +298,11 @@ usage (char **argv)
|
|||
fprintf (stderr, "usage: %s [OPTIONS...] RUNTIMEPATH COMMAND [ARGS...]\n\n", argv[0]);
|
||||
|
||||
fprintf (stderr,
|
||||
" -a Specify path for application (mounted at /self)\n"
|
||||
" -b SOURCE=DEST Bind extra source directory into DEST (must be in /usr, /self, /run/host)\n"
|
||||
" -a Specify path for application (mounted at /app)\n"
|
||||
" -b SOURCE=DEST Bind extra source directory into DEST (must be in /usr, /app, /run/host)\n"
|
||||
" -d SOCKETPATH Use SOCKETPATH as dbus session bus\n"
|
||||
" -D SOCKETPATH Use SOCKETPATH as dbus system bus\n"
|
||||
" -e Make /self/exports writable\n"
|
||||
" -e Make /app/exports writable\n"
|
||||
" -E Make /etc a pure symlink to /usr/etc\n"
|
||||
" -f Mount the host filesystems\n"
|
||||
" -g Allow use of direct rendering graphics\n"
|
||||
|
@ -316,7 +316,7 @@ usage (char **argv)
|
|||
" -p SOCKETPATH Use SOCKETPATH as pulseaudio connection\n"
|
||||
" -s Share Shm namespace with session\n"
|
||||
" -v PATH Mount PATH as /var\n"
|
||||
" -w Make /self writable\n"
|
||||
" -w Make /app writable\n"
|
||||
" -W Make /usr writable\n"
|
||||
" -x SOCKETPATH Use SOCKETPATH as X display\n"
|
||||
" -y SOCKETPATH Use SOCKETPATH as Wayland display\n"
|
||||
|
@ -388,7 +388,9 @@ static const create_table_t create[] = {
|
|||
{ FILE_TYPE_DIR, ".oldroot", 0755 },
|
||||
{ FILE_TYPE_DIR, "usr", 0755 },
|
||||
{ FILE_TYPE_DIR, "tmp", 01777 },
|
||||
{ FILE_TYPE_DIR, "self", 0755},
|
||||
{ FILE_TYPE_DIR, "app", 0755},
|
||||
/* Backwards compat, the app prefix used to be /self */
|
||||
{ FILE_TYPE_SYMLINK, "self", 0755, "app"},
|
||||
{ FILE_TYPE_DIR, "run", 0755},
|
||||
{ FILE_TYPE_DIR, "run/host", 0755},
|
||||
{ FILE_TYPE_DIR, "run/dbus", 0755},
|
||||
|
@ -469,7 +471,7 @@ static const mount_table_t mount_table[] = {
|
|||
|
||||
const char *dont_mount_in_root[] = {
|
||||
".", "..", "lib", "lib32", "lib64", "bin", "sbin", "usr", "boot", "root",
|
||||
"tmp", "etc", "self", "run", "proc", "sys", "dev", "var"
|
||||
"tmp", "etc", "self", "app", "run", "proc", "sys", "dev", "var"
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -1514,9 +1516,9 @@ main (int argc,
|
|||
die ("Too many extra directories");
|
||||
|
||||
if (strncmp (optarg, "/usr/", strlen ("/usr/")) != 0 &&
|
||||
strncmp (optarg, "/self/", strlen ("/self/")) != 0 &&
|
||||
strncmp (optarg, "/app/", strlen ("/app/")) != 0 &&
|
||||
strncmp (optarg, "/run/host/", strlen ("/run/host/")) != 0)
|
||||
die ("Extra directories must be in /usr, /self or /run/host");
|
||||
die ("Extra directories must be in /usr, /app or /run/host");
|
||||
|
||||
extra_dirs[n_extra_dirs].dest = optarg + 1;
|
||||
extra_dirs[n_extra_dirs].src = tmp;
|
||||
|
@ -1705,18 +1707,18 @@ main (int argc,
|
|||
|
||||
if (app_path != NULL)
|
||||
{
|
||||
if (bind_mount (app_path, "self", BIND_PRIVATE | (writable_app?0:BIND_READONLY)))
|
||||
die_with_error ("mount self");
|
||||
if (bind_mount (app_path, "app", BIND_PRIVATE | (writable_app?0:BIND_READONLY)))
|
||||
die_with_error ("mount app");
|
||||
|
||||
if (lock_files)
|
||||
add_lock_dir ("self");
|
||||
add_lock_dir ("app");
|
||||
|
||||
if (!writable_app && writable_exports)
|
||||
{
|
||||
char *exports = strconcat (app_path, "/exports");
|
||||
|
||||
if (bind_mount (exports, "self/exports", BIND_PRIVATE))
|
||||
die_with_error ("mount self/exports");
|
||||
if (bind_mount (exports, "app/exports", BIND_PRIVATE))
|
||||
die_with_error ("mount app/exports");
|
||||
|
||||
free (exports);
|
||||
}
|
||||
|
|
|
@ -390,21 +390,21 @@ xdg_app_run_add_environment_args (GPtrArray *argv_array,
|
|||
}
|
||||
|
||||
static const struct {const char *env; const char *val;} default_exports[] = {
|
||||
{"PATH","/self/bin:/usr/bin"},
|
||||
{"PATH","/app/bin:/usr/bin"},
|
||||
{"LD_LIBRARY_PATH", ""},
|
||||
{"_LD_LIBRARY_PATH", "/self/lib"},
|
||||
{"XDG_CONFIG_DIRS","/self/etc/xdg:/etc/xdg"},
|
||||
{"XDG_DATA_DIRS","/self/share:/usr/share"},
|
||||
{"GI_TYPELIB_PATH","/self/lib/girepository-1.0"},
|
||||
{"_LD_LIBRARY_PATH", "/app/lib"},
|
||||
{"XDG_CONFIG_DIRS","/app/etc/xdg:/etc/xdg"},
|
||||
{"XDG_DATA_DIRS","/app/share:/usr/share"},
|
||||
{"GI_TYPELIB_PATH","/app/lib/girepository-1.0"},
|
||||
{"SHELL","/bin/sh"},
|
||||
};
|
||||
|
||||
static const struct {const char *env; const char *val;} devel_exports[] = {
|
||||
{"ACLOCAL_PATH","/self/share/aclocal"},
|
||||
{"C_INCLUDE_PATH","/self/include"},
|
||||
{"CPLUS_INCLUDE_PATH","/self/include"},
|
||||
{"LDFLAGS","-L/self/lib "},
|
||||
{"PKG_CONFIG_PATH","/self/lib/pkgconfig:/self/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"},
|
||||
{"ACLOCAL_PATH","/app/share/aclocal"},
|
||||
{"C_INCLUDE_PATH","/app/include"},
|
||||
{"CPLUS_INCLUDE_PATH","/app/include"},
|
||||
{"LDFLAGS","-L/app/lib "},
|
||||
{"PKG_CONFIG_PATH","/app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"},
|
||||
{"LC_ALL","en_US.utf8"},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue