Skip to content

Commit

Permalink
Give the user the option to remove the install zpkgs on rootfs upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtrafford committed Jul 22, 2024
1 parent 6f5ba3e commit c65a6e8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion rootfs/web-admin/admin-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ def post_rootfs_install(self, *path_suffix):
self.p(
"Rootfs copied successfully to SD card. If you restart now it "
"will be installed on boot. If you have changed your mind you "
"can delete the new rootfs from the SD card and cancel.")
"can delete the new rootfs from the SD card and cancel. "
"For a major upgrade it is recommended that you remove the"
"installed zpkgs to avoid compatibility issues.")
self.t('button.html', label='Remove zpkgs, Reboot and install it now',
path='system/remove_zpkgs_reboot_rootfs')
self.t('button.html', label='Delete new rootfs and cancel',
path='packages/delete_rootfs')
self.t('button.html', label='Reboot and install it now',
Expand All @@ -469,6 +473,23 @@ def post_delete_rootfs(self):
yield self.revert_rootfs_files()
self.p("Rootfs upgrade successfully cancelled.")

@add_post_page("system/remove_zpkgs_reboot_rootfs")
def post_remove_zpkgs_reboot_rootfs(self):
"""Removing zpkgs, Rebooting System to Install Rootfs"""
ensure_usb_key_inserted()
zpkg_list = sorted(blocking_cmd_lines('zpkg', 'list'))
pkgs = []
if zpkg_list:
for line in zpkg_list:
pkgs.append(line.split()[0])
yield self.zpkg("remove", *pkgs)
yield self.run_command("rm", "-f", ROOTFS_OLD)
yield self.sync()
self.p("Rebooting now, please wait. "
"This page will refresh in 60 seconds...")
self.write('<meta http-equiv="refresh" content="60;url=/admin.html">')
yield self.run_command('reboot')

@add_post_page("system/reboot_rootfs")
def post_reboot_rootfs(self):
"""Rebooting System to Install Rootfs"""
Expand Down

0 comments on commit c65a6e8

Please sign in to comment.