#include "special.h"
#include "mkdir.h"
#include "virt.h"
+#include "fileio.h"
static const char *arg_dest = "/tmp";
static bool arg_enabled = true;
return
hasmntopt(me, "bind") ||
- streq(me->mnt_type, "bind");
+ streq(me->mnt_type, "bind") ||
+ hasmntopt(me, "rbind") ||
+ streq(me->mnt_type, "rbind");
}
static bool mount_is_network(struct mntent *me) {
}
static int add_mount(const char *what, const char *where, const char *type, const char *opts,
- int passno, bool wait, bool noauto, bool nofail, bool automount, bool isbind, bool isnetwork,
+ int passno, bool noauto, bool nofail, bool automount, bool isbind, bool isnetwork,
const char *source) {
char _cleanup_free_
*name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
"Options=%s\n",
opts);
- if (wait)
- fprintf(f,
- "TimeoutSec=0\n");
-
fflush(f);
if (ferror(f)) {
log_error("Failed to write unit file %s: %m", unit);
isnetwork = mount_is_network(me);
k = add_mount(what, where, me->mnt_type, me->mnt_opts,
- me->mnt_passno, false, noauto, nofail,
- automount, isbind, isnetwork,
- "/etc/fstab");
+ me->mnt_passno, noauto, nofail, automount,
+ isbind, isnetwork, "/etc/fstab");
}
if (k < 0)
_cleanup_free_ char *what = NULL, *type = NULL, *opts = NULL, *line = NULL;
int r;
size_t l;
- bool wait = false;
r = read_one_line_file("/proc/cmdline", &line);
if (r < 0) {
return 0;
}
- opts = strdup("defaults");
+ opts = strdup("ro");
type = strdup("auto");
if (!opts || !type)
return log_oom();
- /* root= and roofstype= may occur more than once, the last instance should take precedence.
- * In the case of multiple rootflags= the arguments should be concatenated */
+ /* root= and roofstype= may occur more than once, the last instance should take precedence.
+ * In the case of multiple rootflags= the arguments should be concatenated */
FOREACH_WORD_QUOTED(w, l, line, state) {
char *word, *tmp_word;
if (!opts)
return log_oom();
- } else if (streq(word, "rootwait"))
- wait = true;
+ }
free(word);
}
if (what) {
- log_debug("Found entry what=%s where=/new_root type=%s", what, type);
- r = add_mount(what, "/new_root", type, opts, 0, wait, false, false,
- false, false, false, "/proc/cmdline");
+ log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
+ r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
+ false, false, "/proc/cmdline");
if (r < 0)
return r;