mpm

morphux package manager
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/mpm

commit 25737161709acc3b35b7d89c23ecb6336fb6f005
parent 8f1ed6c3e48a1cd45ed6f9cf53fc8ed596bf748b
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Fri, 18 Mar 2016 15:02:47 +0000

Fix(Kernel): Fix Kernel compilation:

Now have a version tag in kernel binary.
Add a --debug flag to print log in term, not in file.

Diffstat:
Msrc/Exec.cpp | 10+++++++---
Msrc/Kernel.cpp | 5+++--
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/Exec.cpp b/src/Exec.cpp @@ -38,8 +38,10 @@ void Exec::execute(std::list<std::string> args) { fd = open("/var/log/mpm.log", O_WRONLY | O_APPEND | O_CREAT, 0444); Error::log("========================[ " + args.front() + " ]========================\n"); if (!(pid = fork())) { - dup2(fd, 1); - dup2(fd, 2); + if (!Options::isOptions("debug")) { + dup2(fd, 1); + dup2(fd, 2); + } // Yup, this is nasty. Why ? Thank's to const standard. (http://stackoverflow.com/questions/190184/execv-and-const-ness) execve(execArguments[0], const_cast<char * const *>(execArguments), const_cast<char * const *>(environ)); } @@ -47,7 +49,9 @@ void Exec::execute(std::list<std::string> args) { close(fd); if (status) { Error::warning("Execution of " + args.front() + " went wrong."); - Error::execError(); + if (!Options::isOptions("debug")) { + Error::execError(); + } Error::error("Execution error"); } } diff --git a/src/Kernel.cpp b/src/Kernel.cpp @@ -98,11 +98,12 @@ void Kernel::make(void) { e->execute({"make", "modules_install"}); Error::info("Installation"); e->execute({"cp", "-v", "arch/" + Options::config["arch"].asString() + "/boot/bzImage", - "/boot/vmlinuz-" + std::string(s_uname.release) + "-morphux"}); + "/boot/vmlinuz-" + std::string(s_uname.release) + "-morphux-1.0"}); e->execute({"cp", "-v", ".config", "/boot/Config-" + std::string(s_uname.release)}); e->execute({"cp", "-v", "System.map", "/boot/System-map-" + std::string(s_uname.release)}); + Kernel::recompile = 1; } void Kernel::install(void) { @@ -110,7 +111,7 @@ void Kernel::install(void) { Exec *e = new Exec(); res = Error::input("Kernel has been recompiled. Reboot now ? [Yes/no] "); - for (res = 0; res != 'y' && res != 'n' && res != 'Y' && res != 10; ) { + for (; res != 'y' && res != 'n' && res != 'Y' && res != 10; ) { Error::warning("Please type Yes, no or enter."); res = Error::input("Kernel has been recompiled. Reboot now ? [Yes/no] "); }