2016-11-25 17:18:40 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the UCB release of Plan 9. It is subject to the license
|
|
|
|
* terms in the LICENSE file found in the top-level directory of this
|
|
|
|
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
|
|
|
* part of the UCB release of Plan 9, including this file, may be copied,
|
|
|
|
* modified, propagated, or distributed except according to the terms contained
|
|
|
|
* in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <u.h>
|
|
|
|
#include <libc.h>
|
|
|
|
#include <ip.h>
|
|
|
|
|
|
|
|
#include "boot.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
configrc(Method* m)
|
|
|
|
{
|
|
|
|
void configloopback(void);
|
|
|
|
configloopback();
|
|
|
|
bind("#S", "/dev", MAFTER);
|
|
|
|
char *argv[] = {"rc", "-m", rcmainPath, "-i", 0,};
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_print("Step 1. Run an rc. Set things up.\n");
|
|
|
|
switch(jehanne_fork()){
|
2016-11-25 17:18:40 +01:00
|
|
|
case -1:
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_print("configrc: fork failed: %r\n");
|
2016-11-25 17:18:40 +01:00
|
|
|
case 0:
|
|
|
|
exec(rcPath, (const char**)argv);
|
|
|
|
fatal("can't exec rc");
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2017-04-19 23:33:14 +02:00
|
|
|
while(jehanne_waitpid() != -1)
|
2016-11-25 17:18:40 +01:00
|
|
|
;
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_print("Step 2. Run an rc. Verify that things are as you want them.\n");
|
|
|
|
switch(jehanne_fork()){
|
2016-11-25 17:18:40 +01:00
|
|
|
case -1:
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_print("configrc: fork failed: %r\n");
|
2016-11-25 17:18:40 +01:00
|
|
|
case 0:
|
|
|
|
exec(rcPath, (const char**)argv);
|
|
|
|
fatal("can't exec rc");
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2017-04-19 23:33:14 +02:00
|
|
|
while(jehanne_waitpid() != -1)
|
2016-11-25 17:18:40 +01:00
|
|
|
;
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_print("rc is done, continuing...\n");
|
2016-11-25 17:18:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
connectrc(void)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
char buf[64];
|
|
|
|
|
|
|
|
// Later, make this anything.
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_snprint(buf, sizeof buf, "/srv/fossil");
|
2016-11-25 17:18:40 +01:00
|
|
|
fd = open("#s/fossil", 2);
|
|
|
|
if (fd < 0)
|
2017-04-19 23:33:14 +02:00
|
|
|
jehanne_werrstr("dial %s: %r", buf);
|
2016-11-25 17:18:40 +01:00
|
|
|
return fd;
|
|
|
|
}
|