Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(windows): Online Update - Scheduled Services - Stage 2 #8993

Open
2 tasks
rc-swag opened this issue Jun 12, 2023 · 0 comments · Fixed by #9202
Open
2 tasks

feat(windows): Online Update - Scheduled Services - Stage 2 #8993

rc-swag opened this issue Jun 12, 2023 · 0 comments · Fixed by #9202

Comments

@rc-swag
Copy link
Contributor

rc-swag commented Jun 12, 2023

Keyman for Windows online updates - Scheduled Services - Stage1

Table of Contents

  1. Introduction
  2. Detail

Introduction

The ideal end goal of the online updated work is to automate the updated process with zero user interaction.
There are many obstacles to achieving this some of which are out of Keyman control.
However, we can make steps towards this goal.
This issue is for stage 2 adding a Scheduled Service will:

  1. Reduce the need for requesting elevated permissions from the user.
  2. Allow the check for updates to be done on a guaranteed interval independent of Keyman running.
  • Elevation - installing keyboards and Keyman both require elevation - will be solved by the scheduled task.
  • Files in use - updating Keyman files often requires a restart (we can’t avoid).
    - Keyman32.dll will be locked with SetWindowsHookEx hooks – with no clean way of releasing it from memory in all processes
    - kmtip.dll can be locked as it is selected as an input method

Detail

See the original design notes

See Stage 1: #10038 with changes to the Keyman Configuration

Functional Spec

In this Stage, two scheduled tasks shall be added one to check for updates, the second to start the install process as admin avoiding the need to ask the user for Elevated permissions.

  1. Auto Update scheduled task should always be installed, but do nothing if auto updates are off
    1. Check for updates should be triggered by user but run as an elevated scheduled task
  2. Note we must be aware of user vs machine preferences!
    1. e.g. keyboard is installed for machine – but language preferences are per-user
    2. Keyman options are nearly all per-user (except base keyboard I think)
  3. There are two scheduled tasks:
    1. Check for updates – checks online for an update, and downloads it to a cache - replaces equiv functionality in kmshell
      1. Keyman Configuration can trigger the same schedule task download via check for updates now.
      2. Scheduled task is the admin user so that it can store the cache data in folder that the installer running as admin can also access with out having to prompt the user for elevated access.
      3. Scheduled task downloads metadata + binaries and puts them in a cache folder (e.g. ProgramData\Keyman\Updates)
      4. Once it has finished, it signals Keyman Configuration (e.g. SendMessage) OR can just check for the cache download on start up. Keyman.exe could also poll the to see if the download is available hourly.
      5. Write a flag to register for update, and cache file location
      6. Keyman Configuration read the metadata file. (Don't forget about file lock/share conflicts on either side here!)
    2. Apply updates – takes updates that are in the cache, and installs them
      1. If manually started from the Configuration menu, call the scheduled task so the install can still run with elevated permissions, shutdown Keyman, Keyman Config, to minimize file locks – but we understand that a reboot may still be required - again we can’t do anything about this.
      2. the scheduled task sets the background Update State Flag usInstalling
      3. the scheduled task first installs keyboard updates
      4. the scheduled task next installs app updates with the bootstrap executable
      5. immediately after triggering the Windows Installer, the scheduled task shuts down – to avoid locking files.
      6. the bootstrap installer, at the end of install, sets the buState Flag to usWaitingPostInstall
  4. Keyman itself (and Keyman Configuration) must check on startup for the state flag for usInstalling, and immediately exit if so to avoid file lock issues)
    1. If the state flag is usInstalling, present UX to the user to allow them to clear the flag, in the case of a failed install:
      1. For the starting Keyman from Start Menu, or starting Keyman Configuration
  5. To investigate: what happens when a TIP is selected – is it possible for the TIP to say "NO DON'T ACTIVATE!" when it is selected, or does it still end up locked in memory? (This could bring us unstuck even in the login screen where TIPs are available even if not working)

Extra Thoughts
Wild idea for file lock mitigation for TIP from the installer side:
when the installer starts, iterate through all user desktops and set the language to something other than a Keyman-TIP language.

#TODO: Clean UP

Issues / PRs

Epic PR is: #9330

Related PRs

@mcdurdin mcdurdin added this to the A17S15 milestone Jun 13, 2023
@mcdurdin mcdurdin modified the milestones: A17S15, A17S16 Jun 25, 2023
@rc-swag rc-swag changed the title feat(windows): Online Update for Keyman for windows feat(windows): Online Update for Keyman for windows 📲 Jul 5, 2023
@mcdurdin mcdurdin modified the milestones: A17S16, A17S17 Jul 10, 2023
@mcdurdin mcdurdin modified the milestones: A17S17, A17S18 Jul 24, 2023
@mcdurdin mcdurdin modified the milestones: A17S18, A17S19 Aug 5, 2023
@mcdurdin mcdurdin modified the milestones: A17S19, A17S20 Aug 18, 2023
@mcdurdin mcdurdin modified the milestones: A17S20, A17S21 Sep 1, 2023
@mcdurdin mcdurdin modified the milestones: A17S21, A17S22 Sep 15, 2023
@mcdurdin mcdurdin modified the milestones: A17S22, A17S23 Oct 1, 2023
@mcdurdin mcdurdin modified the milestones: A17S23, A17S24 Oct 15, 2023
@mcdurdin mcdurdin removed this from the A17S24 milestone Oct 27, 2023
@rc-swag rc-swag changed the title feat(windows): Online Update - Scheduled Service - Stage 2 feat(windows): Online Update - Scheduled Services - Stage 2 Nov 22, 2023
@rc-swag rc-swag modified the milestones: A17S26, 18.0 Nov 24, 2023
@mcdurdin mcdurdin modified the milestones: 18.0, A18S4 Apr 29, 2024
@darcywong00 darcywong00 modified the milestones: A18S4, A18S5 Jun 21, 2024
@darcywong00 darcywong00 modified the milestones: A18S5, A18S6 Jul 8, 2024
@rc-swag rc-swag modified the milestones: A18S6, A18S8 Jul 8, 2024
@darcywong00 darcywong00 modified the milestones: A18S8, A18S9 Aug 17, 2024
@rc-swag rc-swag modified the milestones: A18S9, A18S10 Aug 19, 2024
@rc-swag rc-swag modified the milestones: A18S10, A18S13 Sep 2, 2024
@rc-swag rc-swag modified the milestones: A18S13, A18S14 Oct 14, 2024
@darcywong00 darcywong00 modified the milestones: A18S14, A18S15 Nov 9, 2024
@rc-swag rc-swag modified the milestones: A18S15, A18S21 Nov 11, 2024
@rc-swag rc-swag modified the milestones: A18S21, 19.0 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment