From 38d3aef74dede2bfe2df8b9319cb4d3f9c675ed4 Mon Sep 17 00:00:00 2001 From: obarun <eric@obarun.org> Date: Fri, 5 Jan 2024 17:56:04 +1100 Subject: [PATCH] Welcome debian. Some distribution do not leave an empty live directory at exit of the initramfs. In case of existing directory, the -m option remount the live directory excluding the MS_NOEXEC flag. --- src/lib66/exec/ssexec_boot.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/lib66/exec/ssexec_boot.c b/src/lib66/exec/ssexec_boot.c index ecc6806c..cab60f2b 100644 --- a/src/lib66/exec/ssexec_boot.c +++ b/src/lib66/exec/ssexec_boot.c @@ -570,17 +570,22 @@ int ssexec_boot(int argc, char const *const *argv, ssexec_t *info) split_tmpfs(fs,live) ; r = is_mnt(fs) ; - if (!r || tmpfs) - { - if (r && tmpfs) - { - log_info("Umount: ",fs) ; - if (umount(fs) == -1) sulogin ("umount: ",fs ) ; + if (!r || tmpfs) { + + if (!r) { + + log_info("Mount: ",fs) ; + if (mount("tmpfs", fs, "tmpfs", MS_NODEV | MS_NOSUID, "mode=0755") == -1) + sulogin("mount: ",fs) ; + + } else if (tmpfs) { + + log_info("Remount: ",fs) ; + if (mount("tmpfs", fs, "tmpfs", MS_REMOUNT | MS_NODEV | MS_NOSUID, "mode=0755") == -1) + sulogin("mount: ",fs) ; } - log_info("Mount: ",fs) ; - if (mount("tmpfs", fs, "tmpfs", MS_NODEV | MS_NOSUID, "mode=0755") == -1) - sulogin("mount: ",fs) ; } + /** respect the path before run API*/ if (setenv("PATH", path, 1) == -1) sulogin("set initial PATH: ",path) ; /** create scandir */ @@ -618,6 +623,7 @@ int ssexec_boot(int argc, char const *const *argv, ssexec_t *info) } if (envdir) { + log_info("Prepare environment") ; if (!environ_clean_envfile_unexport(&envmodifs,envdir)) sulogin("prepare environment from: ",envdir) ; } -- GitLab