Skip to content

Commit

Permalink
feat: certbot renew (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC authored Jan 28, 2024
1 parent 30c5b31 commit 2e70d13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub enum Step {
Bun,
BunPackages,
Cargo,
Certbot,
Chezmoi,
Chocolatey,
Choosenim,
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ fn run() -> Result<()> {
generic::run_ghcli_extensions_upgrade(&ctx)
})?;
runner.execute(Step::Bob, "Bob", || generic::run_bob(&ctx))?;
runner.execute(Step::Certbot, "Certbot", || generic::run_certbot(&ctx))?;

if config.use_predefined_git_repos() {
if config.should_run(Step::Emacs) {
Expand Down
18 changes: 17 additions & 1 deletion src/steps/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ pub fn run_pip_review_update(ctx: &ExecutionContext) -> Result<()> {

Ok(())
}

pub fn run_pip_review_local_update(ctx: &ExecutionContext) -> Result<()> {
let pip_review = require("pip-review")?;

Expand All @@ -557,6 +558,7 @@ pub fn run_pip_review_local_update(ctx: &ExecutionContext) -> Result<()> {

Ok(())
}

pub fn run_pipupgrade_update(ctx: &ExecutionContext) -> Result<()> {
let pipupgrade = require("pipupgrade")?;

Expand All @@ -574,6 +576,7 @@ pub fn run_pipupgrade_update(ctx: &ExecutionContext) -> Result<()> {

Ok(())
}

pub fn run_stack_update(ctx: &ExecutionContext) -> Result<()> {
if require("ghcup").is_ok() {
// `ghcup` is present and probably(?) being used to install `stack`.
Expand Down Expand Up @@ -755,7 +758,7 @@ pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
return Err(SkipStep(String::from(
"Error running `dotnet tool list`. This is expected when a dotnet runtime is installed but no SDK.",
))
.into())
.into());
}
};

Expand Down Expand Up @@ -905,3 +908,16 @@ pub fn run_bob(ctx: &ExecutionContext) -> Result<()> {

ctx.run_type().execute(bob).args(["update", "--all"]).status_checked()
}

pub fn run_certbot(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
let certbot = require("certbot")?;

print_separator("Certbot");

let mut cmd = ctx.run_type().execute(sudo);
cmd.arg(certbot);
cmd.arg("renew");

cmd.status_checked()
}

0 comments on commit 2e70d13

Please sign in to comment.