mirror of
https://github.com/unraid/webgui.git
synced 2026-05-12 15:20:29 -05:00
System update
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function write($message) {
|
||||
$nchan = curl_init();
|
||||
curl_setopt_array($nchan,[
|
||||
CURLOPT_URL => 'http://localhost/pub/plugins?buffer_length=0',
|
||||
CURLOPT_UNIX_SOCKET_PATH => '/var/run/nginx.socket',
|
||||
CURLOPT_POST => 1,
|
||||
CURLOPT_POSTFIELDS => $message,
|
||||
CURLOPT_RETURNTRANSFER => true
|
||||
]);
|
||||
curl_exec($nchan);
|
||||
curl_close($nchan);
|
||||
}
|
||||
|
||||
$url = rawurldecode($argv[1]);
|
||||
$host = parse_url($url)['host'];
|
||||
|
||||
usleep(50000);
|
||||
if (in_array($host,['keys.lime-technology.com','lime-technology.com'])) {
|
||||
$key_file = basename($url);
|
||||
write("Downloading $keyfile ...\n");
|
||||
exec("/usr/bin/wget -q -O ".escapeshellarg("/boot/config/$key_file")." ".escapeshellarg($url), $output, $return_var);
|
||||
if ($return_var === 0) {
|
||||
if (parse_ini_file('/var/local/emhttp/var.ini')['mdState'] == 'STARTED') {
|
||||
write("Installing ... Please Stop array to complete key installation.\n");
|
||||
} else {
|
||||
write("Installed ...\n");
|
||||
}
|
||||
} else {
|
||||
write("ERROR: $return_var\n");
|
||||
}
|
||||
} else {
|
||||
write("ERROR, bad or missing key file URL: $url\n");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user