Commit 96c95ad8 authored by Marius Cramer's avatar Marius Cramer
Browse files

- added anothier lock check for apt

- changed language import to use mb_substr
parent 02e7eaf2
......@@ -36,7 +36,7 @@ function normalize_string($string, $quote, $allow_special = false) {
$new_string = '';
for($c = 0; $c < mb_strlen($string); $c++) {
$char = $string{$c};
$char = mb_substr($string, $c, 1);
if($in_string === true && $escaped === false && $char === $quote) {
// this marks a string end (e.g. for concatenation)
......
......@@ -76,13 +76,13 @@ class cronjob_monitor_system_update extends cronjob {
/*
* first update the "apt database"
*/
shell_exec('apt-get update');
shell_exec('while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do sleep 2; done; apt-get update');
/*
* Then test the upgrade.
* if there is any output, then there is a needed update
*/
$aptData = shell_exec('while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do sleep 2; done; apt-get -s -qq dist-upgrade');
$aptData = shell_exec('while fuser /var/lib/dpkg/lock >/dev/null 2>&1 || fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do sleep 2; done; apt-get -s -qq dist-upgrade');
if ($aptData == '') {
/* There is nothing to update! */
$state = 'ok';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment