|
1257 | 1257 | sysCmd('systemctl daemon-reload'); |
1258 | 1258 |
|
1259 | 1259 | // Start local display |
| 1260 | +$cfgDir = $_SESSION['home_dir'] . '/.config'; |
| 1261 | +if (file_exists($cfgDir)) { |
| 1262 | + $chownUser = $_SESSION['user_id'] . ':' . $_SESSION['user_id']; |
| 1263 | + $result = sysCmd('stat -c %G":"%U ' . $cfgDir . ' | grep "' . $chownUser .'"'); |
| 1264 | + if (empty($result)) { |
| 1265 | + sysCmd('chown ' . $chownUser . ' ' . $cfgDir); |
| 1266 | + $cfgStatus = 'ownership changed to ' . $chownUser; |
| 1267 | + } else { |
| 1268 | + $cfgStatus = 'directory ok'; |
| 1269 | + } |
| 1270 | +} else { |
| 1271 | + $cfgStatus = 'WARNING: directory ' . $cfgDir . ' does not exist'; |
| 1272 | +} |
1260 | 1273 | if ($_SESSION['local_display'] == '1') { |
1261 | | - $cfgStatus = startLocalDisplay(); |
| 1274 | + startLocalDisplay(); |
1262 | 1275 | } |
1263 | 1276 | workerLog('worker: Local display: ' . ($_SESSION['local_display'] == '1' ? 'on' : 'off')); |
1264 | 1277 | workerLog('worker: Chromium ver: ' . sysCmd("dpkg -l | grep -m 1 \"chromium-browser\" | awk '{print $3}' | cut -d\":\" -f 2")[0]); |
@@ -2368,21 +2381,7 @@ function startGpioBtnHandler() { |
2368 | 2381 |
|
2369 | 2382 | // Local display |
2370 | 2383 | function startLocalDisplay() { |
2371 | | - $cfgDir = $_SESSION['home_dir'] . '/.config'; |
2372 | | - if (file_exists($cfgDir)) { |
2373 | | - $chownUser = $_SESSION['user_id'] . ':' . $_SESSION['user_id']; |
2374 | | - $result = sysCmd('stat ' . $cfgDir . ' | grep "' . $_SESSION['user_id'] .'"'); |
2375 | | - if (empty($result)) { |
2376 | | - sysCmd('chown ' . $chownUser . ' ' . $cfgDir); |
2377 | | - $cfgStatus = 'ownership changed to ' . $chownUser; |
2378 | | - } else { |
2379 | | - $cfgStatus = 'directory ok'; |
2380 | | - } |
2381 | | - } else { |
2382 | | - $cfgStatus = 'WARNING: directory ' . $cfgDir . ' does not exist'; |
2383 | | - } |
2384 | 2384 | sysCmd('systemctl start localdisplay'); |
2385 | | - return $cfgStatus; |
2386 | 2385 | } |
2387 | 2386 | function stopLocalDisplay() { |
2388 | 2387 | sysCmd('systemctl stop localdisplay'); |
|
0 commit comments