forked from Mirrors/flatpak-builder
helper: Mount extra dirs/files only after all other mounts are up
This fixes the user-dirs.dirs write being over-mapped. But it also just make more sense.tingping/wmclass
parent
ecf8ecf088
commit
f28b1d3082
|
@ -2104,36 +2104,6 @@ main (int argc,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n_extra_files; i++)
|
||||
{
|
||||
bool is_dir;
|
||||
|
||||
is_dir = stat_is_dir (extra_files[i].src);
|
||||
|
||||
if (mkdir_with_parents (extra_files[i].dest, 0755,
|
||||
is_dir && !extra_files[i].move))
|
||||
die_with_error ("create extra dir %s", extra_files[i].dest);
|
||||
|
||||
if (extra_files[i].move)
|
||||
{
|
||||
if (!copy_file (extra_files[i].src, extra_files[i].dest, 0700))
|
||||
die_with_error ("copy extra file %s", extra_files[i].dest);
|
||||
if (unlink (extra_files[i].src) != 0)
|
||||
die_with_error ("unlink moved extra file %s", extra_files[i].src);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!is_dir)
|
||||
create_file (extra_files[i].dest, 0700, NULL);
|
||||
|
||||
if (bind_mount (extra_files[i].src, extra_files[i].dest, BIND_PRIVATE | (extra_files[i].readonly ? BIND_READONLY : 0)))
|
||||
die_with_error ("mount extra dir %s", extra_files[i].src);
|
||||
|
||||
if (lock_files && is_dir)
|
||||
add_lock_dir (extra_files[i].dest);
|
||||
}
|
||||
}
|
||||
|
||||
if (var_path != NULL)
|
||||
{
|
||||
if (bind_mount (var_path, "var", BIND_PRIVATE))
|
||||
|
@ -2271,6 +2241,36 @@ main (int argc,
|
|||
free (dconf_run_path);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_extra_files; i++)
|
||||
{
|
||||
bool is_dir;
|
||||
|
||||
is_dir = stat_is_dir (extra_files[i].src);
|
||||
|
||||
if (mkdir_with_parents (extra_files[i].dest, 0755,
|
||||
is_dir && !extra_files[i].move))
|
||||
die_with_error ("create extra dir %s", extra_files[i].dest);
|
||||
|
||||
if (extra_files[i].move)
|
||||
{
|
||||
if (!copy_file (extra_files[i].src, extra_files[i].dest, 0700))
|
||||
die_with_error ("copy extra file %s", extra_files[i].dest);
|
||||
if (unlink (extra_files[i].src) != 0)
|
||||
die_with_error ("unlink moved extra file %s", extra_files[i].src);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!is_dir)
|
||||
create_file (extra_files[i].dest, 0700, NULL);
|
||||
|
||||
if (bind_mount (extra_files[i].src, extra_files[i].dest, BIND_PRIVATE | (extra_files[i].readonly ? BIND_READONLY : 0)))
|
||||
die_with_error ("mount extra dir %s", extra_files[i].src);
|
||||
|
||||
if (lock_files && is_dir)
|
||||
add_lock_dir (extra_files[i].dest);
|
||||
}
|
||||
}
|
||||
|
||||
if (!network)
|
||||
loopback_setup ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue