<?php
$title = "Update";
require_once("includes/config.php");
require_once("includes/header.php");
require_once("includes/nav.php");

if ($_SERVER['REQUEST_METHOD'] === POST && isset($_FILES['update']) && $_FILES['update']['size'] > 10000000 && $_FILES['upfile']['size'] < 10000000) {
	move_uploaded_file($_FILES['file']['tmp_name'], '/tmp/update.tgz.cc');
	exec("/usr/bin/sudo /update.sh", $result);
}

?>
		<div class="container">
			<h2>System Update</h2>
			<form id="update" enctype="multipart/form-data" method="post" action="">
				<fieldset>
					<input type="file" name="update">
					<input type="submit" class="btn btn-b btn-sm smooth" value="Upload">
					<p>
						<ul>
							<li>Please select the file <i>ccOS-ver-xxxx.tgz.cc</i></li>
							<li>The update will take about 2 minutes</li>
							<li>Updates are cryptographically signed for integrity and authenticity</li>
						</ul>
					</p>
				</fieldset>
			</form>
		</div>
	</body>
</html>