Example #1
0
 public function download()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $updater = new Updater();
         if ($updater->updateAvailable()) {
             $image_data = $updater->downloadLatest();
             die('OK');
         }
     }
 }
Example #2
0
 public function do_upgrade()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $updater = new Updater();
         if ($updater->updateAvailable()) {
             $image_data = $updater->downloadLatest();
             if (!$updater->validateSignature($image_data)) {
                 die('INVALID SIGNATURE');
             }
             if ($updater->performUpdate($image_data)) {
                 die('Upgrading, please wait for the device to reboot.');
             } else {
                 die('FAILED');
             }
         }
     }
 }