Registry Mirror
Skip to content

Conversation

@MrChromebox

Copy link
Copy Markdown
Contributor
  • Refactor gui-init so that all operations are contained with shell functions, leading to much clearer program flow between menus and sub-menus
  • Ensure when user selects 'skip/continue to main menu' that is what happens (no further prompts)
  • Improve consistency of background color use on error/warning screens, and persist background color / error state from initial checks to the main menu to sub-menus
  • Improve error handling when no fixed disks used/found on system

Signed-off-by: Matt DeVillier matt.devillier@puri.sm

@tlaurion

Copy link
Copy Markdown
Collaborator

Wow😃
Will review more in depth but this is awesome!

Expect merge day middle of next week

@MrChromebox

Copy link
Copy Markdown
Contributor Author

I tested all these with qemu-fbwhiptail, so only really scratched the surface. I'll be testing on the L14 tomorrow/next week and may have a few additional fixes/commits based on how that goes

@MrChromebox
MrChromebox force-pushed the gui-init_overhaul branch 3 times, most recently from a76c02e to 1c3f2f7 Compare September 24, 2021 21:45
@tlaurion

Copy link
Copy Markdown
Collaborator

@MrChromebox any plan on moving gui functions to /etc/gui_functions ?

@MrChromebox

Copy link
Copy Markdown
Contributor Author

I suppose that's an option. Where would we draw the line between what goes in gui_functions and gui_init?

@tlaurion

Copy link
Copy Markdown
Collaborator

Well, the way you are heading would permit calling

. /etc/gui_functions if whiptail is present and permit to do a lot without leaving GUI and needing To go into authenticated recovery shell.

Then maybe even unifying them with /etc/functions later.

This would remove redundancy (mount_boot, verify_global_checkums and others ) while permitting other scripts to reuse what is there and cleaner code in the long run?

If the main scripts (policies) were calling only functions which are doing what they are supposed to be doing, Heads would become way more flexible, which seems to be the desire of the community with forks like @hardenedvault with its own autoboot script now, tpm2 included and system76 systems interest from the community that seems to be present out there.

More reusability means more collaboration and endorsement which is somehow a really good thing for a project like this to move faster.

@MrChromebox

Copy link
Copy Markdown
Contributor Author

More reusability means more collaboration and endorsement which is somehow a really good thing for a project like this to move faster.

of course, that's certainly one of the goals of this effort. Moving things into /etc/gui-functions only makes sense IMO if we're going to split things up such that the same function names can be used with or without whiptail, and the versions in /etc/gui_functions mirror those in /etc/functions just with whiptail. We'd need to split the common stuff out so it could be included in both cases.

Primarily though, my goal here is to improve the reliability and UX of the gui-based boards, since that's what's of concern to Purism's users. Refactoring to improve readability, reuse, and ease of future enhancements is a close 2nd though :)

@MrChromebox

Copy link
Copy Markdown
Contributor Author

@tlaurion ok, done adding to this, should be ready for review/testing

Name better reflects function purpose, allows 'update_totp'
to be used to actually update the TOTP code.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Break menus and menu items into functions where possible.
Improves readability of code / functional flow, and
makes future refactoring easier.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Now that all menu options are encapsulated in shell
functions, move menu handling from the main loop to
inside the menu/submenu function itself.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Checking the keyring for a GPG and updating the TOTP/HTOP
status need only happen once at initial boot; the latter
can be updated at any later time from the main menu itself.
Having them repeated each loop of the main menu is unnecessary
(and often annoying). Likewise, the default auto boot can be
moved and the first_pass (and unused MAIN_MENU_OPTIONS)
variable dropped.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Persist the background color (and error state) through
the main menu and all submenus. Use warning
background color for destructive operations, error color
for errors.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Currently, if no disks on system, selection of a new /boot
device will silently fail and simply return the user to the
previous screen. Add an error dialog if no disks found.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Modify update_checksums() to return 0/1 on success/failure, and modify
callers to notify the user on error with a GUI msg.

Set background color as appropriate in gui-init.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Allow user to cancel HOTPKEY check, set BG color appropriately

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
If user selects to manually update the TOTP via the menu,
we should do it regardless of elapsed time from previous
check. Otherwise, HOTP will be checked regardless of validity
of TOTP.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
After updating/flashing a new ROM, a new TOTP secret must be generated,
but the $TOTP variable needs to be updated afterwards, otherwise it
will show the previous failure which led to the new secret being
created.

Fix this by re-calling update_totp() after generating a new secret
or resetting the TPM.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
@tlaurion

Copy link
Copy Markdown
Collaborator

Oupsies everyone. This is merged as per #955 having been merged first.

@tlaurion tlaurion closed this Oct 15, 2021
@MrChromebox

Copy link
Copy Markdown
Contributor Author

closing since #955, which was rebased on this PR, got merged out of order - so commits are already in

@MrChromebox
MrChromebox deleted the gui-init_overhaul branch October 21, 2021 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants