Lines Matching +full:self +full:- +full:update

53     shutil.copyfile(files[0], os.path.join(UPDATE_PATH, "image-u-boot-env"))
57 def __init__(self, bus, name):
58 super(BmcFlashControl, self).__init__(conn=bus, object_path=name)
60 self.Set(DBUS_NAME, "status", "Idle")
61 self.Set(DBUS_NAME, "filename", "")
62 self.Set(DBUS_NAME, "preserve_network_settings", True)
63 self.Set(DBUS_NAME, "restore_application_defaults", False)
64 self.Set(DBUS_NAME, "update_kernel_and_apps", False)
65 self.Set(DBUS_NAME, "clear_persistent_files", False)
66 self.Set(DBUS_NAME, "auto_apply", False)
69 self.download_error_handler, signal_name="DownloadError"
72 self.download_complete_handler, signal_name="DownloadComplete"
75 self.update_process = None
76 self.progress_name = None
79 def updateViaTftp(self, ip, filename):
80 self.Set(DBUS_NAME, "status", "Downloading")
81 self.TftpDownload(ip, filename)
84 def update(self, filename):
85 self.Set(DBUS_NAME, "filename", filename)
86 self.download_complete_handler(filename, filename)
89 def TftpDownload(self, ip, filename):
90 self.Set(DBUS_NAME, "filename", filename)
94 def download_error_handler(self, filename):
95 if filename == self.Get(DBUS_NAME, "filename"):
96 self.Set(DBUS_NAME, "status", "Download Error")
98 def download_complete_handler(self, outfile, filename):
99 # do update
100 if filename != self.Get(DBUS_NAME, "filename"):
105 self.Set(DBUS_NAME, "status", "Download Complete")
109 if not self.Get(DBUS_NAME, "update_kernel_and_apps"):
110 copy_files["image-bmc"] = True
112 copy_files["image-kernel"] = True
113 copy_files["image-rofs"] = True
115 if self.Get(DBUS_NAME, "restore_application_defaults"):
116 copy_files["image-rwfs"] = True
128 "ERROR: File not found in update archive: " + f
133 self.Set(DBUS_NAME, "status", "Unpack Error")
141 if self.Get(DBUS_NAME, "clear_persistent_files"):
164 if self.Get(DBUS_NAME, "preserve_network_settings"):
170 self.Set(DBUS_NAME, "status", "Unpack Error")
172 self.Verify()
174 def Verify(self):
175 self.Set(DBUS_NAME, "status", "Checking Image")
179 "/run/initramfs/update",
180 "--no-flash",
181 "--no-save-files",
182 "--no-restore-files",
183 "--no-clean-saved-files",
187 self.Set(DBUS_NAME, "status", "Image ready to apply.")
188 if self.Get(DBUS_NAME, "auto_apply"):
189 self.Apply()
191 self.Set(DBUS_NAME, "auto_apply", False)
195 "/run/initramfs/update",
196 "--no-flash",
197 "--ignore-mount",
198 "--no-save-files",
199 "--no-restore-files",
200 "--no-clean-saved-files",
204 self.Set(
210 self.Set(DBUS_NAME, "status", "Verify error: %s" % e.output)
212 self.Set(
215 "Verify error: problem calling update: %s" % e.strerror,
218 def Cleanup(self):
219 if self.progress_name:
221 os.unlink(self.progress_name)
222 self.progress_name = None
227 self.update_process = None
228 self.Set(DBUS_NAME, "status", "Idle")
231 def Abort(self):
232 if self.update_process:
234 self.update_process.kill()
238 if file.startswith("image-"):
241 self.Cleanup()
244 def GetUpdateProgress(self):
247 if self.update_process and self.update_process.returncode is None:
248 self.update_process.poll()
250 if self.update_process is None:
252 elif self.update_process.returncode > 0:
253 self.Set(DBUS_NAME, "status", "Apply failed")
254 elif self.update_process.returncode is None:
256 else: # (self.update_process.returncode == 0)
259 if file.startswith("image-"):
265 self.Set(DBUS_NAME, "status", msg)
267 msg = self.Get(DBUS_NAME, "status") + "\n"
268 if self.progress_name:
270 prog = open(self.progress_name, "r")
274 # cr will be -1 if no '\r' is found
275 cr = line.rfind("\r", 0, -2)
284 def Apply(self):
286 self.Set(DBUS_NAME, "status", "Writing images to flash")
291 self.progress_name = progress.name
292 self.update_process = subprocess.Popen(
293 ["/run/initramfs/update"],
301 self.progress_name = None
312 def PrepareForUpdate(self):
317 "copy-files-to-ram copy-base-filesystem-to-ram",
321 # the u-boot redundant environment variables since initramfs can only
327 "copy-files-to-ram copy-base-filesystem-to-ram",
330 self.Set(DBUS_NAME, "status", "Switch to update mode in progress")