From: Michael Tremer Date: Tue, 21 Sep 2021 17:29:57 +0000 (+0000) Subject: shell: Setup build environment before entering the shell X-Git-Tag: 0.9.28~944 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48dc31f7a6ac8407a4811c6e6c29a166f69adaea;p=pakfire.git shell: Setup build environment before entering the shell Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index f2a618258..d2d3eb461 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -683,7 +683,7 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con if (r) { // Drop to a shell for debugging if (flags & PAKFIRE_BUILD_INTERACTIVE) - pakfire_shell(pakfire); + pakfire_execute_shell(pakfire); goto ERROR; } @@ -799,12 +799,12 @@ ERROR: } PAKFIRE_EXPORT int pakfire_shell(struct pakfire* pakfire) { - const char* argv[] = { - "/bin/bash", "--login", NULL, - }; + int r; - const int flags = - PAKFIRE_EXECUTE_INTERACTIVE | PAKFIRE_EXECUTE_ENABLE_NETWORK; + // Setup build environment + r = pakfire_build_setup(pakfire); + if (r) + return r; - return pakfire_execute(pakfire, argv, NULL, flags, NULL, NULL); + return pakfire_execute_shell(pakfire); } diff --git a/src/libpakfire/execute.c b/src/libpakfire/execute.c index 307e98f7b..f0bfada32 100644 --- a/src/libpakfire/execute.c +++ b/src/libpakfire/execute.c @@ -751,6 +751,17 @@ out: return r; } +int pakfire_execute_shell(struct pakfire* pakfire) { + const char* argv[] = { + "/bin/bash", "--login", NULL, + }; + + const int flags = + PAKFIRE_EXECUTE_INTERACTIVE | PAKFIRE_EXECUTE_ENABLE_NETWORK; + + return pakfire_execute(pakfire, argv, NULL, flags, NULL, NULL); +} + int pakfire_execute_ldconfig(struct pakfire* pakfire) { char path[PATH_MAX]; diff --git a/src/libpakfire/include/pakfire/execute.h b/src/libpakfire/include/pakfire/execute.h index 07317ec1a..73d38d8c1 100644 --- a/src/libpakfire/include/pakfire/execute.h +++ b/src/libpakfire/include/pakfire/execute.h @@ -45,6 +45,7 @@ int pakfire_execute_capture_stdout(struct pakfire* pakfire, void* data, int prio const char* line, size_t length); int pakfire_execute_capture_stdout_to_array(struct pakfire* pakfire, void* data, int priority, const char* line, size_t length); +int pakfire_execute_shell(struct pakfire* pakfire); int pakfire_execute_ldconfig(struct pakfire* pakfire); #endif