+
+ --
+ -- This is step 1-3, which does the user interaction and
+ -- image upload.
+ --
+
+ -- Step 1: file upload, error on unsupported image format
+ elseif not has_image or not has_support or step == 1 then
+ -- If there is an image but user has requested step 1
+ -- or type is not supported, then remove it.
+ if has_image then
+ luci.fs.unlink(tmpfile)
+ end
+
+ luci.template.render("admin_system/upgrade", {
+ step=1,
+ bad_image=(has_image and not has_support or false),
+ keepavail=keep_avail
+ } )
+
+ -- Step 2: present uploaded file, show checksum, confirmation
+ elseif step == 2 then
+ luci.template.render("admin_system/upgrade", {
+ step=2,
+ checksum=image_checksum(),
+ filesize=luci.fs.stat(tmpfile).size,
+ flashsize=storage_size(),
+ keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1")
+ } )
+
+ -- Step 3: load iframe which calls the actual flash procedure
+ elseif step == 3 then
+ luci.template.render("admin_system/upgrade", {
+ step=3,
+ keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1")
+ } )
+ end