-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·49 lines (47 loc) · 1.33 KB
/
configure
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
#!/usr/bin/php
<?php
$php = exec("which php");
$path = exec("pwd");
$config = array(
'server' => array(
'port' => 1821
),
'interface' => array(
'port' => 1822
)
);
/**
* Write config.json
**/
echo "Write config.json...";
$config_json = json_encode($config);
file_put_contents("./public/config.json", $config_json);
echo "done\n";
/**
* Configure Launchd Script
**/
echo "Write Launchd-Skript ...";
$launchd = file_get_contents("launchd.plist");
$parsed_launchd = str_replace("PATH", $path, $launchd);
file_put_contents("net.kanedo.AppStart.plist",$parsed_launchd);
echo "done\n";
/**
* Configure Shell Script
**/
echo "Write Shell-Script...";
$appstart = file_get_contents("./server/app-start.sh");
$parsed_appstart = str_replace("PHP", $php, $appstart);
$parsed_appstart = str_replace("PATH", $path, $parsed_appstart);
file_put_contents("./server/app-start", $parsed_appstart);
echo "done\n";
/**
* Configure Public Interface Script
**/
echo "Write Public Interface Script...";
$interface = file_get_contents('interface.sh');
$parsed_interface = str_replace("PHP", $php, $interface);
$parsed_interface = str_replace("PATH", $path, $parsed_interface);
$parsed_interface = str_replace("THEPORT", $config['interface']['port'], $parsed_interface);
file_put_contents("interface", $parsed_interface);
echo "done\n";
?>