diff options
-rw-r--r-- | www/commission/index.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/www/commission/index.php b/www/commission/index.php index 2cf5320..f35f2fb 100644 --- a/www/commission/index.php +++ b/www/commission/index.php @@ -5,6 +5,7 @@ * Licensed under MIT */ $cmd = "/usr/sbin/mts-io-sysfs show product-id"; +$sledinv = "/sys/class/leds/led-status/invert"; $handle = popen($cmd, 'r'); $product = fread($handle,4192); pclose($handle); @@ -181,6 +182,31 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ if (strlen($result2) > 0) { syslog(LOG_ALERT, "passwd log: status: $status2 result: $result2"); } + + syslog(LOG_ALERT, "Check for /usr/bin/mts-ubpasswd existence"); + if (!file_exists("/usr/sbin/mts-ubpasswd")) { + syslog(LOG_ALERT, "No /usr/bin/mts-ubpasswd existence"); + $finished = "Commissioning Complete"; + $formdisplay = false; + $password_err = $result2; + $username_err = $result; + // Disable commissioning + $data = 'ENABLED=\"no\"'; + file_put_contents("/run/mt-commission",$data); + + // shut off web server + $cmd = "/usr/sbin/start-stop-daemon -S -p /var/run/commissionoff.pid -b -a /bin/bash -- -c " . + "/usr/libexec/commission/off.sh"; + syslog(LOG_ALERT, "turn off web server: command: $cmd"); + $handle = popen($cmd, 'r'); + $result = trim(fread($handle, 4192)); + $status = pclose($handle); + if ($status > 0) { + syslog(LOG_ALERT, "turn off commissioning service: command: $cmd"); + syslog(LOG_ALERT, "stopping service: status: $status result: $result"); + } + goto err_exit; + } $cmd = "/usr/sbin/mts-ubpasswd -up >$tmpfile 2>&1"; $handle = popen($cmd, 'w'); |