Pre Post transaction hooks for snapshots and such.

This commit is contained in:
2026-09-14 22:48:05 +02:00
parent 4a4e6927bd
commit 2fedcd0805
8 changed files with 98 additions and 34 deletions
+27 -30
View File
@@ -4,57 +4,54 @@ Program to manage update process of Kira Linux. Creating snapshots. Dealing with
There should be some documantation here.
hive-up uses `/var/lib/hive-up/hyve-db.json` file as database for stuff
And `/etc/hive-up.toml` as config file.
As an daemon hive-up righ now doing only periodical checks for updates.
hive-up uses `/etc/hive-up.toml` as config file.
```text
Update program fot Kira Linux :3
Usage: hive-up <COMMAND>
Commands:
cli Perform local operations
remote Ask hive-up daemon something
daemon Run hive-up in daemon mode
help Print this message or the help of the given subcommand(s)
boot Manage system boot
pac Intended to be used by pacman hooks
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
```
For cli mode:
Pac mode:
```text
Usage: hive-up cli <--upgrade|--update-boot|--init-boot-menu|--init-boot>
Usage: hive-up pac <COMMAND>
Commands:
snapshot-system Creates snapshoots of /usr and /var subvolumea
start This supposed to be called by pacman hook before transaction hive-up will check for /var/lib/hive-up/pac-lock and will not create snapshots in case it present Its safe lock mesure to prevent multiple snapshots on system fixing or some corner cases Lock file can be deleted by `pac finish` that should be called by pacman after transaction
finis This supposed to be called by pacman hook before transaction. Right now only thing it does is removes /var/lib/hive-up/pac-lock file
help Print this message or the help of the given subcommand(s)
Options:
--upgrade Perform system upgrade
--update-boot Install new kernel into boot partition
--init-boot-menu Cleans up and recreates UFI boot menu
--init-boot Cleans up and recreates UFI boot menu and /EFI dir content
-h, --help Print help
-h, --help Print help
Print help
```
For remote mode:
Boot mode:
```text
Usage: hive-up remote <--check-updates|--updates-avail|--schedule-update>
Usage: hive-up boot <COMMAND>
Commands:
update Install new kernel into boot partition
efi-menu-init Cleans up and recreates UFI boot menu
init Cleans up and recreates UFI boot menu and /EFI dir content
help Print this message or the help of the given subcommand(s)
Options:
--check-updates Ask daemon to check for updates
--updates-avail Ask daemon if there is any updates available
--schedule-update Ask daemon to perform system update on next reboot
-h, --help Print help
-h, --help Print help
```
`hive-up daemon` - do not have any flags for now.
`hive-up cli --upgrade` - generally not supposed to be called by user. It get called by system service manager (dinit) after hive-up service stop (on reboot or system shutdown)
When `hive-up cli --upgrade` is called, it checks if `update_on_reboot` flag is set in **DB** or `auto_update` flag checked in **config**, and if `updates_available` in **DB** is non zero. Update routine continue only if this conditios are met.
1. It creates snapshots of `/usr` and `/var` subvolumes
2. It sets `update_status` to **false** in **DB**
3. Performs update, and if everything was fine sets `update_status` to **true** in **DB**
After this, system reboots, and on system boot Nyanit figures up what to do with failed updates if any