forked from rsanc77/os161.11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-asst0.php
50 lines (37 loc) · 1.3 KB
/
build-asst0.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?
$name = posix_getpwuid(posix_geteuid());
$dir = $name['dir']; // home directory
$assignment='ASST0';
/////////////////////
// Change source_tree to the top of the OS/161 source code
// default: ~/os161/os161-1.11
////////////////////
$source_tree = $dir.'/os161/os161-1.11';
////////////////////
// Change compiled_directory to the location in which you want your binaries compiled
// default: ~/os161/root
///////////////////
$compiled_directory = $dir.'/os161/root';
if (!file_exists($source_tree)) {
print "$source_tree does not exist.\n";
die();
}
$path = shell_exec('echo $PATH');
if (!preg_match(':/usr/local/sys161:', $path)) {
print "PATH environment variable is not properly set.\n";
print "PATH must include /usr/local/sys161 and /usr/local/sys161/bin\n";
print " Please edit your ~/.bash_profile to change PATH.\n";
exit;
}
print "Attempting to configure ...";
chdir($source_tree);
print shell_exec('./configure --ostree='.$compiled_directory);
chdir($source_tree.'/kern/conf');
print shell_exec('./config '.$assignment);
chdir($source_tree.'/kern/compile/'.$assignment);
print "Attempting to compile...";
print shell_exec('make depend');
print shell_exec('make');
print shell_exec('make install');
shell_exec('cp /usr/local/sys161/sys161.conf.sample '.$compiled_directory.'/sys161.conf');
?>