Mount system fonts in /run/host/fonts

tingping/wmclass
Alexander Larsson 2015-03-06 11:26:07 +01:00
parent 5bfee405b1
commit 957bf050bd
4 changed files with 30 additions and 10 deletions

View File

@ -9,6 +9,7 @@ AM_CPPFLAGS = \
-DXDG_APP_SYSTEMDIR=\"$(localstatedir)/xdg-app\"\
-DXDG_APP_BASEDIR=\"$(pkgdatadir)\" \
-DXDG_APP_TRIGGERDIR=\"$(pkgdatadir)/triggers\" \
-DSYSTEM_FONTS_DIR=\"$(SYSTEM_FONTS_DIR)\" \
-DHELPER=\"$(bindir)/xdg-app-helper\" \
$(NULL)

View File

@ -34,6 +34,13 @@ AC_ARG_WITH(dbus_service_dir,
DBUS_SERVICE_DIR=$with_dbus_service_dir
AC_SUBST(DBUS_SERVICE_DIR)
AC_ARG_WITH(system_fonts_dir,
AS_HELP_STRING([--with-system-fonts-dir=PATH],[Directory where system fonts are, [default=/usr/share/fonts]]),
with_system_fonts_dir="$withval", with_system_fonts_dir=/usr/share/fonts)
SYSTEM_FONTS_DIR=$with_system_fonts_dir
AC_SUBST(SYSTEM_FONTS_DIR)
AC_CHECK_HEADER([sys/capability.h], have_caps=yes, AC_MSG_ERROR([sys/capability.h header not found]))
AC_SUBST([GLIB_COMPILE_RESOURCES], [`$PKG_CONFIG --variable glib_compile_resources gio-2.0`])

View File

@ -291,6 +291,9 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **
(const char **)opt_allow,
(const char **)opt_forbid);
g_ptr_array_add (argv_array, g_strdup ("-b"));
g_ptr_array_add (argv_array, g_strdup_printf ("/run/host/fonts=%s", SYSTEM_FONTS_DIR));
g_ptr_array_add (argv_array, g_strdup ("-a"));
g_ptr_array_add (argv_array, g_file_get_path (app_files));
g_ptr_array_add (argv_array, g_strdup ("-I"));

View File

@ -236,7 +236,7 @@ usage (char **argv)
fprintf (stderr,
" -a Specify path for application (mounted at /self)\n"
" -b SOURCE=DEST Bind extra source directory into DEST (must be in /usr or /self)\n"
" -b SOURCE=DEST Bind extra source directory into DEST (must be in /usr, /self, /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"
@ -326,6 +326,7 @@ static const create_table_t create[] = {
{ FILE_TYPE_DIR, "tmp", 01777 },
{ FILE_TYPE_DIR, "self", 0755},
{ FILE_TYPE_DIR, "run", 0755},
{ FILE_TYPE_DIR, "run/host", 0755},
{ FILE_TYPE_DIR, "run/dbus", 0755},
{ FILE_TYPE_DIR, "run/media", 0755},
{ FILE_TYPE_DIR, "run/user", 0755},
@ -404,6 +405,11 @@ typedef enum {
BIND_RECURSIVE = (1<<3),
} bind_option_t;
typedef struct {
char *src;
char *dest;
} ExtraDir;
#define MAX_EXTRA_DIRS 32
#define MAX_LOCK_DIRS (MAX_EXTRA_DIRS+2)
@ -1185,8 +1191,7 @@ main (int argc,
char *monitor_path = NULL;
char *app_id = NULL;
char *var_path = NULL;
char *extra_dirs_src[MAX_EXTRA_DIRS];
char *extra_dirs_dest[MAX_EXTRA_DIRS];
ExtraDir extra_dirs[MAX_EXTRA_DIRS];
int n_extra_dirs = 0;
char *pulseaudio_socket = NULL;
char *x11_socket = NULL;
@ -1240,11 +1245,12 @@ main (int argc,
die ("Too many extra directories");
if (strncmp (optarg, "/usr/", strlen ("/usr/")) != 0 &&
strncmp (optarg, "/self/", strlen ("/self/")) != 0)
die ("Extra directories must be in /usr or /self");
strncmp (optarg, "/self/", strlen ("/self/")) != 0 &&
strncmp (optarg, "/run/host/", strlen ("/run/host/")) != 0)
die ("Extra directories must be in /usr, /self or /run/host");
extra_dirs_dest[n_extra_dirs] = optarg + 1;
extra_dirs_src[n_extra_dirs] = tmp;
extra_dirs[n_extra_dirs].dest = optarg + 1;
extra_dirs[n_extra_dirs].src = tmp;
n_extra_dirs++;
break;
@ -1439,11 +1445,14 @@ main (int argc,
for (i = 0; i < n_extra_dirs; i++)
{
if (bind_mount (extra_dirs_src[i], extra_dirs_dest[i], BIND_PRIVATE | BIND_READONLY))
die_with_error ("mount extra dir %s", extra_dirs_src[i]);
if (mkdir_with_parents (extra_dirs[i].dest, 0755))
die_with_error ("create extra dir %s", extra_dirs[i].dest);
if (bind_mount (extra_dirs[i].src, extra_dirs[i].dest, BIND_PRIVATE | BIND_READONLY))
die_with_error ("mount extra dir %s", extra_dirs[i].src);
if (lock_files)
add_lock_dir (extra_dirs_dest[i]);
add_lock_dir (extra_dirs[i].dest);
}
if (var_path != NULL)