From: Michael Tremer Date: Sat, 19 Oct 2024 09:01:08 +0000 (+0000) Subject: cli: snapshots: Commit forgotten files X-Git-Tag: 0.9.30~998 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=455722342a4c8d00699f28cf1e2c2d57c40a3d44;p=pakfire.git cli: snapshots: Commit forgotten files Signed-off-by: Michael Tremer --- diff --git a/src/cli/lib/snapshot_update.c b/src/cli/lib/snapshot_update.c new file mode 100644 index 000000000..2f5fa2e72 --- /dev/null +++ b/src/cli/lib/snapshot_update.c @@ -0,0 +1,55 @@ +/*############################################################################# +# # +# Pakfire - The IPFire package management system # +# Copyright (C) 2024 Pakfire development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#include + +#include + +#include "command.h" +#include "pakfire.h" +#include "snapshot_update.h" + +static const char* doc = "Update the snapshot"; + +int cli_snapshot_update(void* data, int argc, char* argv[]) { + struct pakfire* pakfire = NULL; + int r; + + struct cli_config* cli_config = data; + + // Parse the command line + r = cli_parse(NULL, NULL, NULL, doc, NULL, 0, argc, argv, NULL); + if (r) + goto ERROR; + + // Setup pakfire + r = cli_setup_pakfire(&pakfire, cli_config); + if (r) + goto ERROR; + + // Make a new snapshot + r = pakfire_update_snapshot(pakfire); + +ERROR: + if (pakfire) + pakfire_unref(pakfire); + + return r; +} diff --git a/src/cli/lib/snapshot_update.h b/src/cli/lib/snapshot_update.h new file mode 100644 index 000000000..021cdf8ab --- /dev/null +++ b/src/cli/lib/snapshot_update.h @@ -0,0 +1,26 @@ +/*############################################################################# +# # +# Pakfire - The IPFire package management system # +# Copyright (C) 2024 Pakfire development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#ifndef PAKFIRE_CLI_SNAPSHOT_UPDATE_H +#define PAKFIRE_CLI_SNAPSHOT_UPDATE_H + +int cli_snapshot_update(void* data, int argc, char* argv[]); + +#endif /* PAKFIRE_CLI_SNAPSHOT_UPDATE_H */