New upstream version 2020.6
This commit is contained in:
commit
12212491d5
22 files changed
+127
-59
No files matched your search
@@ -101,10 +101,9 @@ sysroot_is_configured_ro (const char *sysroot)
|
||||
bool ret = false;
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t nread;
|
||||
/* Note getline() will reuse the previous buffer */
|
||||
bool in_sysroot = false;
|
||||
while ((nread = getline (&line, &len, f)) != -1)
|
||||
while (getline (&line, &len, f) != -1)
|
||||
{
|
||||
/* This is an awful hack to avoid depending on GLib in the
|
||||
* initramfs right now.
|
||||
@@ -252,7 +251,7 @@ main(int argc, char *argv[])
|
||||
* sysroot, we still need a writable /etc. And to avoid race conditions
|
||||
* we ensure it's writable in the initramfs, before we switchroot at all.
|
||||
*/
|
||||
if (mount ("/etc", "/etc", NULL, MS_BIND, NULL) < 0)
|
||||
if (mount ("etc", "etc", NULL, MS_BIND, NULL) < 0)
|
||||
err (EXIT_FAILURE, "failed to make /etc a bind mount");
|
||||
/* Pass on the fact that we discovered a readonly sysroot to ostree-remount.service */
|
||||
int fd = open (_OSTREE_SYSROOT_READONLY_STAMP, O_WRONLY | O_CREAT | O_CLOEXEC, 0644);
|
||||
|
||||
@@ -112,6 +112,11 @@ main(int argc, char *argv[])
|
||||
bool sysroot_configured_readonly = unlink (_OSTREE_SYSROOT_READONLY_STAMP) == 0;
|
||||
do_remount ("/sysroot", !sysroot_configured_readonly);
|
||||
|
||||
/* And also make sure to make /etc rw again. We make this conditional on
|
||||
* sysroot_configured_readonly because only in that case is it a bind-mount. */
|
||||
if (sysroot_configured_readonly)
|
||||
do_remount ("/etc", true);
|
||||
|
||||
/* If /var was created as as an OSTree default bind mount (instead of being a separate filesystem)
|
||||
* then remounting the root mount read-only also remounted it.
|
||||
* So just like /etc, we need to make it read-write by default.
|
||||
|
||||
Reference in new issue
Block a user