set the RC_UNAME environment variable when updating dependencies

This is needed because the network script uses this variable in the
depend() function but it wasn't exported when this was run.

Reported-by: <aaly90@gmail.com>
This commit is contained in:
William Hubbs 2012-10-04 22:01:33 -05:00
parent ae9acfaed8
commit 361f5ce2b8

View File

@ -28,6 +28,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/utsname.h>
#include "librc.h" #include "librc.h"
#define GENDEP RC_LIBEXECDIR "/sh/gendepends.sh" #define GENDEP RC_LIBEXECDIR "/sh/gendepends.sh"
@ -747,12 +749,15 @@ rc_deptree_update(void)
size_t i, k, l; size_t i, k, l;
bool retval = true; bool retval = true;
const char *sys = rc_sys(); const char *sys = rc_sys();
struct utsname uts;
/* Some init scripts need RC_LIBEXECDIR to source stuff /* Some init scripts need RC_LIBEXECDIR to source stuff
Ideally we should be setting our full env instead */ Ideally we should be setting our full env instead */
if (!getenv("RC_LIBEXECDIR")) if (!getenv("RC_LIBEXECDIR"))
setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 0); setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 0);
if (uname(&uts) == 0)
setenv("RC_UNAME", uts.sysname, 1);
/* Phase 1 - source all init scripts and print dependencies */ /* Phase 1 - source all init scripts and print dependencies */
if (!(fp = popen(GENDEP, "r"))) if (!(fp = popen(GENDEP, "r")))
return false; return false;