From e777ed1390dda1100693236326963677249b75bd Mon Sep 17 00:00:00 2001 From: Matej Kafka Date: Tue, 9 Apr 2024 13:46:13 +0200 Subject: [PATCH] README: Add manual instructions for upgrading Pog --- README.md | 11 +++++++++++ app/Pog/_knowledge/Pog self-update.txt | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 app/Pog/_knowledge/Pog self-update.txt diff --git a/README.md b/README.md index dac9be9..bec2ed2 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,17 @@ Alternatively, you can manually install Pog by following these steps: 3. Download and unpack the archive to your preferred directory for portable applications. 4. Run `Pog/setup.cmd`. +### Upgrading an existing installation of Pog + +Ideally, I would like Pog to be able to update itself. However, it internally uses a compiled .NET assembly, which gets loaded automatically when Pog is imported and PowerShell provides no way to unload assemblies other than exiting the whole process, meaning that Pog must not be running when it is updated. Before I devise a better solution, do the following steps manually when you want to upgrade: + +1. Exit all instances of PowerShell where Pog was invoked. +2. Manually download the target release archive. +3. Enter the `Pog` directory, where Pog is installed. +4. Delete everything except for the `cache` and `data` directory. +5. Copy the contents of the `Pog` directory from the archive into the `Pog` directory from step 3. +6. Run the extracted `setup.cmd` script. + ## Basic usage Install a package (use `Tab` to get a list of matching packages): diff --git a/app/Pog/_knowledge/Pog self-update.txt b/app/Pog/_knowledge/Pog self-update.txt new file mode 100644 index 0000000..7f231e4 --- /dev/null +++ b/app/Pog/_knowledge/Pog self-update.txt @@ -0,0 +1,13 @@ +the `app` directory can be moved while Pog is running from it, it just cannot be deleted +however, the first time we attempt to load something from the app directory (e.g. container Env_*.psm1), it will fail + +we could do a custom update system, which +1) ensures that no other PowerShell instance has Pog loaded +2) moves `app` to `app-old` +3) unpacks the new version, WITHOUT loading any pwsh file or dll (must not call the container) + the hard part +4) configures the new Pog version (ideally by running `Enable`, but that's gonna be hard) +5) launches a detached background process which waits until user closes the last loaded Pog instance and then deletes the old directory +6) prompt the user to close the current shell + +TODO: still quite wonky, check how other similar software does it \ No newline at end of file