Project

General

Profile

Download (17.3 KB) Statistics
| Branch: | Tag: | Revision:
1
/*
2
 * gitsync
3
 *
4
 * part of pfSense (https://www.pfsense.org)
5
 * Copyright (c) 2010-2012 Erik Fonnesbeck
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2022 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * Licensed under the Apache License, Version 2.0 (the "License");
12
 * you may not use this file except in compliance with the License.
13
 * You may obtain a copy of the License at
14
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * Unless required by applicable law or agreed to in writing, software
18
 * distributed under the License is distributed on an "AS IS" BASIS,
19
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
 * See the License for the specific language governing permissions and
21
 * limitations under the License.
22
 */
23

    
24
require_once("globals.inc");
25
require_once("filter.inc");
26
require_once("shaper.inc");
27
require_once("rrd.inc");
28
require_once("pfsense-utils.inc");
29

    
30
$GIT_PKG = "git"; // Either "git" or the full package URL
31
$GIT_BIN= "/usr/local/bin/git";
32
$GIT_REPO = "https://github.com/pfsense/pfsense.git";
33
$DEFAULT_BRANCH = "master";
34
$CODIR =  "/root/pfsense";
35
$GITSYNC_MERGE = "/root/.gitsync_merge";
36

    
37
/* NOTE: Set branches here */
38
$branches = array(
39
	"master" => "2.7.0 development branch",
40
	"RELENG_2_6_0" => "2.6.0 stable branch",
41
	"build_commit" => "The commit originally used to build the image"
42
);
43

    
44
global $g;
45
global $argv;
46
global $command_split;
47

    
48
if (is_array($command_split)) {
49
	$temp_args = array_slice($command_split, 2);
50
} else {
51
	$temp_args = array_slice($argv, 3);
52
}
53

    
54
$valid_args = array(
55
	"--minimal" => "\tPerform a copy of only the updated files.\n" .
56
	    "\tNot recommended if the system has files modified by any method other\n" .
57
	    "\tthan gitsync.\n",
58
	"--diff" => "\tPerform a copy of only the different and missing files.\n" .
59
	    "\tRecommended for SSD if system has files modified by any method other\n" .
60
	    "\tthan gitsync.\n",
61
	"--show-files" => "\tShow the updated, different and missing files.\n" .
62
	    "\t(when used with --minimal and --diff options)\n",
63
	"--show-command" => "\tShow the constructed command.\n",
64
	"--dry-run" => "\tDry-run only.  No files copied.\n",
65
	"--help" => "\tDisplay this help list.\n"
66
	);
67
$args = array();
68
$arg_count = 0;
69
while (!empty($temp_args)) {
70
	$arg = array_shift($temp_args);
71
	if ($arg[0] == '-') {
72
		switch ($arg) {
73
			case "--help":
74
				echo "Usage: playback gitsync [options] [[repository] <branch>]\nOptions:\n";
75
				foreach ($valid_args as $arg_name => $arg_desc) {
76
					echo $arg_name . "\n" . $arg_desc;
77
				}
78
				exit;
79
			case "--upgrading":
80
				// Disables all interactive functions and neither PHP
81
				// nor the web GUI will be killed or restarted.
82
				$upgrading = true;
83
			case (isset($valid_args[$arg])):
84
				$args[$arg] = true;
85
				break;
86
			default:
87
				echo "Invalid option: {$arg}\nUse --help for usage information.\n";
88
				exit;
89
		}
90
	} else {
91
		$args[$arg_count++] = $arg;
92
	}
93
}
94

    
95
if (!function_exists('post_cvssync_commands')) {
96
function post_cvssync_commands() {
97
	echo "===> Removing FAST-CGI temporary files...\n";
98
	exec("/usr/bin/find /tmp -name \"php-fastcgi.socket*\" -exec rm -rf {} \;");
99
	exec("/usr/bin/find /tmp -name \"*.tmp\" -exec rm -rf {} \;");
100

    
101
	exec("/bin/rm -rf /tmp/xcache/* 2>/dev/null");
102

    
103
	echo "===> Upgrading configuration (if needed)...\n";
104
	convert_config();
105

    
106
	echo "===> Configuring filter...";
107
	exec("/etc/rc.filter_configure_sync");
108
	exec("/sbin/pfctl -f /tmp/rules.debug");
109
	echo "\n";
110

    
111
	if (file_exists("/etc/rc.php_ini_setup")) {
112
		echo "===> Running /etc/rc.php_ini_setup...";
113
		exec("/etc/rc.php_ini_setup >/dev/null 2>&1");
114
		echo "\n";
115
	}
116

    
117
	/* lock down console if necessary */
118
	echo "===> Locking down the console if needed...\n";
119
	reload_ttys();
120

    
121
	echo "===> Signaling PHP and nginx restart...";
122
	$fd = fopen("/tmp/restart_nginx", "w");
123
	fwrite($fd, "#!/bin/sh\n");
124
	fwrite($fd, "sleep 5\n");
125
	fwrite($fd, "/usr/local/sbin/pfSctl -c 'service restart webgui'\n");
126
	fclose($fd);
127
	mwexec_bg("/bin/sh /tmp/restart_nginx");
128
	echo "\n";
129
}
130
}
131

    
132
if (!function_exists('isUrl')) {
133
function isUrl($url = "") {
134
	if ($url) {
135
		if (strstr($url, "mainline") or
136
			strstr($url, ".git") or
137
			strstr($url, "git://")) {
138
			return true;
139
		}
140
	}
141
	return false;
142
}
143
}
144

    
145
if (!function_exists('run_cmds')) {
146
function run_cmds($cmds) {
147
	global $debug;
148
	foreach ($cmds as $cmd) {
149
		if ($debug) {
150
			echo "Running $cmd";
151
		}
152
		exec($cmd);
153
	}
154
}
155
}
156

    
157
unlink_if_exists("/tmp/config.cache");
158

    
159
if (!file_exists($GIT_BIN)) {
160
	require_once("pkg-utils.inc");
161

    
162
	echo "Cannot find git, installing...\n";
163
	if (!pkg_call('install -y -q git')) {
164
		echo "\nERROR: Unable to install git pkg.\n";
165
		return;
166
	}
167
}
168

    
169
# Remove mainline if exists (older)
170
if (is_dir("/root/pfsense/mainline")) {
171
	exec("/bin/rm -rf /root/pfsense/mainline");
172
}
173

    
174
# Remove RELENG_1_2 if exists (older)
175
if (is_dir("/root/pfsense/RELENG_1_2")) {
176
	exec("/bin/rm -rf /root/pfsense/RELENG_1_2");
177
}
178

    
179
# Remove HEAD if exists (older)
180
if (is_dir("/root/pfsense/HEAD")) {
181
	exec("/bin/rm -rf /root/pfsense/HEAD");
182
}
183

    
184
if (file_exists("/root/cvssync_backup.tgz")) {
185
	$backup_date = `ls -lah /root/cvssync_backup.tgz | awk '{ print $6,$7,$8 }'`;
186
	$tmp = array("RESTORE" => "Restores prior CVSSync backup data performed at {$backup_date}");
187
	$branches = array_merge($branches, $tmp);
188
}
189

    
190
if (is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
191
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} config remote.origin.url", $output_str, $ret);
192
	if (is_array($output_str) && !empty($output_str[0])) {
193
		$GIT_REPO = $output_str[0];
194
	}
195
	unset($output_str);
196
}
197

    
198
if (!$args[0] && !$upgrading) {
199
	echo "\nCurrent repository is $GIT_REPO\n";
200
	echo "\nPlease select which branch you would like to sync against:\n\n";
201
	foreach ($branches as $branchname => $branchdesc) {
202
		echo "{$branchname} \t {$branchdesc}\n";
203
	}
204
	echo "\nOr alternatively you may enter a custom RCS branch URL (Git or HTTP).\n\n";
205
	$branch = readline("> ");
206
	echo "\n";
207
} else {
208
	$branch = $args[0];
209
}
210

    
211
if ($args[1] == "NOBACKUP") {
212
	$nobackup = true;
213
} else {
214
	$nobackup = false;
215
}
216

    
217
// If the repository has been fetched before, build a list of its branches.
218
if (is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
219
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} branch -r", $branch_list, $ret);
220
	if ($ret == 0 && is_array($branch_list)) {
221
		foreach ($branch_list as $branch_item) {
222
			$branch_item = substr(strrchr($branch_item, "/"), 1);
223
			if (!isset($branches[$branch_item])) {
224
				$branches[$branch_item] = " ";
225
			}
226
		}
227
	}
228
}
229

    
230
$found = false;
231
foreach ($branches as $branchname => $branchdesc) {
232
	if ($branchname == $branch) {
233
		$found = true;
234
		break;
235
	}
236
}
237
if (!$found) {
238
	if (isURL($branch) && !$upgrading) {
239
		if ($args[1]) {
240
			$GIT_REPO = $branch;
241
			$branch = $args[1];
242
			$found = true;
243
		} else {
244
			echo "\n";
245
			echo "NOTE: $branch was not found.\n\n";
246
			$command = readline("Is this a custom GIT URL? [y]? ");
247
			if (strtolower($command) == "y" or $command == "") {
248
				$GIT_REPO = $branch;
249
				$command = readline("Checkout which branch [${DEFAULT_BRANCH}]? ");
250
				if ($command == "") {
251
					$branch = $DEFAULT_BRANCH;
252
				}
253
				if ($command) {
254
					$branch = $command;
255
				}
256
				$found = true;
257
			}
258
		}
259
	}
260
	if (!$found) {
261
		echo "\nNo valid branch found.  Exiting.\n\n";
262
		exit;
263
	}
264
}
265

    
266
$merge_repos = array();
267
if (file_exists($GITSYNC_MERGE)) {
268
	$gitsync_merges = file($GITSYNC_MERGE, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
269
	if (!empty($gitsync_merges) && is_array($gitsync_merges)) {
270
		echo "\n===> Automatic merge list read from ${GITSYNC_MERGE}\n";
271
		foreach ($gitsync_merges as $merge_line_num => $merge_line) {
272
			$merge_comments = explode("#", trim($merge_line));
273
			if (empty($merge_comments[0])) {
274
				continue;
275
			}
276

    
277
			$merge_line = explode(" ", trim($merge_comments[0]));
278
			if (count($merge_line) != 2 || empty($merge_line[0]) || empty($merge_line[1])) {
279
				echo "\nLine " . ($merge_line_num + 1) . " does not have the correct parameter count or has improper spacing.\n";
280
				echo "Expected parameters:  repository_url branch\n";
281
				echo "Line read:  " . implode(" ", $merge_line) . "\n\n";
282
				echo "Aborting automatic merge.\n\n";
283
				$merge_repos = array();
284
				break;
285
			}
286
			$merge_repos[] = array('repo' => $merge_line[0], 'branch' => $merge_line[1]);
287
		}
288
	}
289
}
290
if (!$args[0] && !$upgrading) {
291
	do {
292
		echo "\nAdd a custom RCS branch URL (Git or HTTP) to merge in or press enter if done.\n\n";
293
		$merge_repo = readline("> ");
294
		if (!empty($merge_repo)) {
295
			$merge_branch = readline("Merge which branch [${DEFAULT_BRANCH}]? ");
296
			if ($merge_branch == "") {
297
				$merge_repos[] = array('repo' => $merge_repo, 'branch' => $DEFAULT_BRANCH);
298
			} else if ($merge_branch) {
299
				$merge_repos[] = array('repo' => $merge_repo, 'branch' => $merge_branch);
300
			}
301
		}
302
	} while (!empty($merge_repo));
303
}
304

    
305
if ($branch == "RESTORE") {
306
	if (!file_exists("/root/cvssync_backup.tgz")) {
307
		echo "Sorry, we could not find a previous CVSSync backup file.\n";
308
		exit();
309
	}
310
	echo "===> Restoring previous CVSSync backup... Please wait...\n";
311
	exec("/usr/bin/tar Uxpf /root/cvssync_backup.tgz -C /");
312
	post_cvssync_commands();
313
	exit();
314
} else {
315
	$nobackup = true; // do not backup embedded
316
}
317

    
318
if ($nobackup == false) {
319
	echo "===> Backing up current pfSense information...\n";
320
	echo "===> Please wait... ";
321
	exec("/usr/bin/tar czPf /root/cvssync_backup.tgz --exclude /root --exclude /dev --exclude /tmp --exclude /var/run --exclude /var/empty /");
322
	$size = filesize("/root/cvssync_backup.tgz");
323
	echo "{$size} bytes.\n\n";
324
	sleep(5);
325
}
326

    
327
echo "===> Checking out $branch\n";
328

    
329
// Git commands for resetting to the specified branch
330
if ($branch == "build_commit") {
331
	$git_cmd = array(
332
		"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} branch " . escapeshellarg($branch) . " 2>/dev/null",
333
		"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} checkout -f " . escapeshellarg($branch) . " 2>/dev/null",
334
		"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} reset --hard " . escapeshellarg(trim(file_get_contents("/etc/version.lastcommit")))
335
	);
336
} else {
337
	$git_cmd = array(
338
		"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} branch " . escapeshellarg($branch) . " " . escapeshellarg("origin/{$branch}") . " 2>/dev/null",
339
		"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} checkout -f " . escapeshellarg($branch) . " 2>/dev/null",
340
		"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} reset --hard " . escapeshellarg("origin/{$branch}")
341
	);
342
}
343

    
344
// Git 'er done!
345
if (is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
346
	echo "===> Fetching updates...\n";
347
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} config remote.origin.url " . escapeshellarg($GIT_REPO));
348
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} fetch");
349
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} clean -f -x -d");
350
	run_cmds($git_cmd);
351
} else {
352
	exec("/bin/mkdir -p $CODIR/pfSenseGITREPO");
353
	echo "Executing cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone $GIT_REPO pfSenseGITREPO\n";
354
	exec("cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone " . escapeshellarg($GIT_REPO) . " pfSenseGITREPO");
355
	if (is_dir("$CODIR/pfSenseGITREPO/pfSense")) {
356
		exec("/bin/mv $CODIR/pfSenseGITREPO/pfSense $CODIR/pfSenseGITREPO/pfSenseGITREPO");
357
	}
358
	if (is_dir("$CODIR/pfSenseGITREPO/mainline")) {
359
		exec("/bin/mv $CODIR/pfSenseGITREPO/mainline $CODIR/pfSenseGITREPO/pfSenseGITREPO");
360
	}
361
	run_cmds($git_cmd);
362
}
363

    
364
foreach ($merge_repos as $merge_repo) {
365
	echo "===> Merging branch {$merge_repo['branch']} from {$merge_repo['repo']}\n";
366
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} pull " . escapeshellarg($merge_repo['repo']) . " " . escapeshellarg($merge_repo['branch']), $output_str, $ret);
367
	unset($output_str);
368
	if ($ret <> 0) {
369
		echo "\nMerge failed.  Aborting sync.\n\n";
370
		run_cmds($git_cmd);
371
		exit;
372
	}
373
}
374

    
375
$updated_files_array[1] = array();
376
if (isset($args["--minimal"])) {
377
	if (file_exists("/etc/version.gitsync")) {
378
		$old_revision = trim(file_get_contents("/etc/version.gitsync"));
379
	} else if (file_exists("/etc/version.lastcommit")) {
380
		$old_revision = trim(file_get_contents("/etc/version.lastcommit"));
381
	}
382

    
383
	# Find updated files.
384
	$updated_files = shell_exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} diff --name-only --relative=src " . escapeshellarg($old_revision));
385

    
386
	# Get the path of each updated file.
387
	preg_match_all('@(?:^(.+?)$)@sim', $updated_files, $updated_files_array, PREG_PATTERN_ORDER);
388

    
389
	if(isset($args["--show-files"])) {
390
		echo "===> Updated Files: \n";
391
		print_r($updated_files_array[1]);
392
	}
393
}
394

    
395
// Save new commit ID for later minimal file copies
396
if(!isset($args["--dry-run"])) {
397
	exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} rev-parse -q --verify HEAD > /etc/version.gitsync");
398
}
399

    
400
// Remove files that we do not want to overwrite the system with
401
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/crontab");
402
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/master.passwd");
403
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/passwd");
404
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/fstab");
405
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/ttys");
406
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/group");
407
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/fstab");
408
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/platform");
409
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/boot/device.hints");
410
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/boot/loader.conf");
411
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/boot/loader.rc");
412
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/syslog.conf");
413
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/root/.shrc");
414
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/root/.tcshrc");
415
exec("/bin/rm -rf {$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/conf*");
416
exec("/bin/rm -rf {$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/cf 2>/dev/null");
417
@chmod("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/tmp", 01777);
418

    
419
$different_files_array[1] = array();
420
$missing_files_array[1] = array();
421
if(isset($args["--diff"])) {
422
	# Find different and missing files.
423
	$different_missing_files = shell_exec("/usr/bin/diff -qr / $CODIR/pfSenseGITREPO/pfSenseGITREPO/src/ | /usr/bin/grep -E '^(Files .*? and $CODIR/pfSenseGITREPO/pfSenseGITREPO/src/.*? differ)|(Only in $CODIR/pfSenseGITREPO/pfSenseGITREPO/src/)'");
424

    
425
	# Get the path of each different or missing file.
426
	preg_match_all('@(?:^Files .*? and '.$CODIR.'/pfSenseGITREPO/pfSenseGITREPO/src/(.+?) differ.*?$)@sim', $different_missing_files, $different_files_array, PREG_PATTERN_ORDER);
427
	preg_match_all('@(?:^Only in '.$CODIR.'/pfSenseGITREPO/pfSenseGITREPO/src/(.+?)$)@sim', $different_missing_files, $missing_files_array, PREG_PATTERN_ORDER);
428

    
429
	# Deal with diff's output format of missing files (path: missing_file).
430
	foreach ($missing_files_array[1] as $key => $file) {
431

    
432
		# Most of the time there will be only the one ': ' injected by diff output.  So global replace with dir delimiter (/) is fine.
433
		$tmp = str_replace(": ", "/", $file, $count);
434
		if ($count == 1)
435
			$file = ltrim($tmp, "/");
436

    
437
		# For the very rare case a path component (dir or file) contains ': ' as well, then need to find and replace only the ': ' injected by diff output.
438
		else {
439
			$tmp = $file;
440
			do {
441
				$pos = strrpos($tmp, ": ");
442
				if ($pos) {
443
					$tmp = substr($tmp, 0, $pos);
444
					$res = is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO/src/$tmp/");
445
				}
446
			} while (!$res && $pos);
447

    
448
			if ($res)
449
				$file = ltrim($tmp . "/" . substr($file, $pos+2), "/");
450
		}
451

    
452
		$missing_files_array[1][$key] = $file;
453
	}
454

    
455
	if(isset($args["--show-files"])) {
456
		echo "===> Different Files: \n";
457
		print_r($different_files_array[1]);
458
		echo "===> Missing Files: \n";
459
		print_r($missing_files_array[1]);
460
	}
461
}
462

    
463
# Files to be copied.
464
if(isset($args["--minimal"]) || isset($args["--diff"])) {
465
	$files_to_copy_array = array_merge($updated_files_array[1], $different_files_array[1], $missing_files_array[1]);
466
	$files_to_copy_array = array_unique($files_to_copy_array);
467

    
468
	unset($updated_files_array, $different_files_array, $missing_files_array);
469

    
470
	# Convert the list from an array to a space separated quoted string.  Quoted for white space file name support.
471
	if (count($files_to_copy_array) > 0) {	# Leave the string empty/unset if there is nothing to copy.
472
		$files_to_copy = '"' . implode('" "', $files_to_copy_array) . '"';
473
	}
474
	$qty_files_to_copy = count($files_to_copy_array);
475
	unset($files_to_copy_array);
476
} else {
477
	$files_to_copy = '.';
478
	$qty_files_to_copy = chr(8);
479
}
480

    
481
$tar_options = '-C ./src';
482

    
483
echo "===> Installing $qty_files_to_copy new files...\n";
484

    
485
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; /usr/bin/tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; /usr/bin/tar -Uxpf -)";
486

    
487
if (!empty($files_to_copy)) {
488
	if(isset($args["--show-command"])) {
489
		echo "===> Command: \n$command\n";
490
	}
491
	if(!isset($args["--dry-run"])) {
492
		exec($command);
493
	}
494
} else {
495
	echo "Already up-to-date.\n";
496
	$upgrading = true;
497
}
498

    
499
// Reset the repository to restore the deleted files
500
exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} reset --hard >/dev/null 2>/dev/null");
501

    
502
// Remove obsolete files
503
$files_to_remove = file("/etc/pfSense.obsoletedfiles");
504
foreach ($files_to_remove as $file_to_remove) {
505
	if (file_exists($file_to_remove)) {
506
		exec("/bin/rm -f $file_to_remove");
507
	}
508
}
509

    
510
if (!$upgrading) {
511
	post_cvssync_commands();
512
}
513

    
514
echo "===> Checkout complete.\n";
515
echo "\n";
516
if (!$upgrading) {
517
	echo "The system is now sync'd and PHP and nginx will be restarted in 5 seconds.\n\n";
518
} else {
519
	echo "The system is now sync'd.\n\n";
520
}
(14-14/27)