Skip to content

Commit

Permalink
chore: fix some systemd things + a couple todos
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Murdaca <[email protected]>
  • Loading branch information
runcom committed Sep 30, 2022
1 parent 13cc0f2 commit dd27f68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/systemd/system/greenboot-grub2-set-counter.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Before=ostree-finalize-staged.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/greenboot set-counter
ExecStart=/usr/libexec/greenboot/greenboot set-counter
MountFlags=slave

[Install]
RequiredBy=ostree-finalize-staged.service
2 changes: 1 addition & 1 deletion dist/systemd/system/greenboot.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Before=shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/greenboot check
ExecStart=/usr/libexec/greenboot/greenboot check
MountFlags=slave

[Install]
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct CheckArguments {}
struct SetCounterArguments {}

fn check(_args: &CheckArguments) -> Result<(), Error> {
// TODO: run only if boot_success=0 && boot_counter != "" || empty too

// TODO: logic for watchdog
if is_boot_wd_triggered()? {
// do something for wd triggered boot
Expand All @@ -60,6 +62,7 @@ fn check(_args: &CheckArguments) -> Result<(), Error> {
let grub2_editenv_list = parse_grub2_editenv_list()?;
if let Some(v) = grub2_editenv_list.get("boot_counter") {
if v == "-1" {
// TODO: cleanup "bad" upgrade deployment, there's a command I don't remember...
Command::new("rpm-ostree").arg("rollback").status()?;
Command::new("grub2-editenv")
.arg("-")
Expand Down Expand Up @@ -106,6 +109,7 @@ fn check(_args: &CheckArguments) -> Result<(), Error> {
return Ok(());
}
// TODO: run green checks...
// TODO: if we are here, we need to cleanup all other previous deployments
Command::new("grub2-editenv")
.arg("-")
.arg("set")
Expand Down

0 comments on commit dd27f68

Please sign in to comment.