mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
Merge pull request #72 from abucodonosor/master
Some cleanup Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
commit
06d3161ffe
2 files changed
+42
-27
No files matched your search
+32
-27
@@ -155,36 +155,39 @@ static void networking(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Debian/Ubuntu/Busybox interfaces file */
|
/* Debian/Ubuntu/Busybox/RH/Suse */
|
||||||
fp = fopen("/etc/network/interfaces", "r");
|
if (fexist("/sbin/ifup")) {
|
||||||
if (fp) {
|
/* interfaces file */
|
||||||
int i = 0;
|
fp = fopen("/etc/network/interfaces", "r");
|
||||||
char buf[160];
|
if (fp) {
|
||||||
|
int i = 0;
|
||||||
|
char buf[160];
|
||||||
|
|
||||||
/* Bring up all 'auto' interfaces */
|
/* Bring up all 'auto' interfaces */
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
while (fgets(buf, sizeof(buf), fp)) {
|
||||||
char cmd[80];
|
char cmd[80];
|
||||||
char *line, *ifname = NULL;
|
char *line, *ifname = NULL;
|
||||||
|
|
||||||
chomp(buf);
|
chomp(buf);
|
||||||
line = strip_line(buf);
|
line = strip_line(buf);
|
||||||
|
|
||||||
if (!strncmp(line, "auto", 4))
|
if (!strncmp(line, "auto", 4))
|
||||||
ifname = &line[5];
|
ifname = &line[5];
|
||||||
if (!strncmp(line, "allow-hotplug", 13))
|
if (!strncmp(line, "allow-hotplug", 13))
|
||||||
ifname = &line[14];
|
ifname = &line[14];
|
||||||
|
|
||||||
if (!ifname)
|
if (!ifname)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snprintf(cmd, 80, "/sbin/ifup %s", ifname);
|
snprintf(cmd, 80, "/sbin/ifup %s", ifname);
|
||||||
run_interactive(cmd, "Bringing up interface %s", ifname);
|
run_interactive(cmd, "Bringing up interface %s", ifname);
|
||||||
i++;
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
if (i)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
if (i)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fall back to bring up at least loopback */
|
/* Fall back to bring up at least loopback */
|
||||||
@@ -251,6 +254,11 @@ int main(int argc, char* argv[])
|
|||||||
uev_init(&loop);
|
uev_init(&loop);
|
||||||
ctx = &loop;
|
ctx = &loop;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the PATH early to something sane
|
||||||
|
*/
|
||||||
|
setenv("PATH", _PATH_STDPATH, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mount base file system, kernel is assumed to run devtmpfs for /dev
|
* Mount base file system, kernel is assumed to run devtmpfs for /dev
|
||||||
*/
|
*/
|
||||||
@@ -340,9 +348,6 @@ int main(int argc, char* argv[])
|
|||||||
/* Set hostname as soon as possible, for syslog et al. */
|
/* Set hostname as soon as possible, for syslog et al. */
|
||||||
set_hostname(&hostname);
|
set_hostname(&hostname);
|
||||||
|
|
||||||
/* Set default PATH, for uid 0 */
|
|
||||||
setenv("PATH", _PATH_STDPATH, 1);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mount filesystems
|
* Mount filesystems
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
@@ -36,6 +36,16 @@
|
|||||||
#include <lite/lite.h>
|
#include <lite/lite.h>
|
||||||
#include <uev/uev.h>
|
#include <uev/uev.h>
|
||||||
|
|
||||||
|
/* just in case */
|
||||||
|
#ifndef _PATH_STDPATH
|
||||||
|
#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PATH_VARRUN
|
||||||
|
#define _PATH_VARRUN "/var/run/"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define CMD_SIZE 256
|
#define CMD_SIZE 256
|
||||||
#define LINE_SIZE 1024
|
#define LINE_SIZE 1024
|
||||||
#define BUF_SIZE 4096
|
#define BUF_SIZE 4096
|
||||||
|
|||||||
Reference in new issue
Block a user