Add a pkgclean command.

This commit is contained in:
Tom Alexander 2024-09-29 21:05:37 -04:00
parent 5b8880252b
commit bc59cab0cc
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -7,7 +7,7 @@ use crate::db::DbHandle;
use crate::db::DbJailAction;
pub(crate) const ACTION_UPDATE_JAIL: &str = "update_jail";
const ACTION_UPDATE_JAIL_INTERVAL: u64 = 604800;
const ACTION_UPDATE_JAIL_INTERVAL: u64 = 1209600;
pub(crate) fn update_jail(
db_conn: &mut DbHandle,
@ -21,6 +21,14 @@ pub(crate) fn update_jail(
.arg("-u")
.status()?
.exit_ok()?;
Command::new("poudriere")
.arg("pkgclean")
.arg("-A")
.arg("-j")
.arg(action.jail_name.as_str())
.arg("-y")
.status()?
.exit_ok()?;
let next_run = (SystemTime::now() + Duration::from_secs(ACTION_UPDATE_JAIL_INTERVAL))
.duration_since(SystemTime::UNIX_EPOCH)?
.as_secs();