summaryrefslogtreecommitdiffstats
path: root/tmp/post_upgrade_command.php
blob: fdb1f3c6c99d33fc213db80e25a106c1a898ecf3 (plain)
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
#!/usr/local/bin/php -f 
<?php

	/* upgrade embedded users serial console */
	require_once("globals.inc");
	require_once("config.inc");
	require_once("functions.inc");

	if(file_exists("/usr/local/bin/git") && isset($config['system']['gitsync']['synconupgrade'])) {
		if(!empty($config['system']['gitsync']['repositoryurl']))
			exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git config remote.origin.url " . escapeshellarg($config['system']['gitsync']['repositoryurl']));
		if(!empty($config['system']['gitsync']['branch']))
			system("pfSsh.php playback gitsync " . escapeshellarg($config['system']['gitsync']['branch']) . " --upgrading");
	}

	if($g['platform'] == "embedded") {
		$config['system']['enableserial'] = true;
		write_config();
	}

	$newslicedir = "";
	if ($argv[1] != "")
		$newslicedir = '/tmp/' . $argv[1];
	system("echo \"Adding serial port settings ({$newslicedir})...\" >> /conf/upgrade_log.txt");
	setup_serial_port("upgrade", $newslicedir);
		
	$files_to_process = file("/etc/pfSense.obsoletedfiles");
	foreach($files_to_process as $filename) 
		if(file_exists($filename)) 
			exec("/bin/rm -f $filename");

?>
OpenPOWER on IntegriCloud