]> git.ipfire.org Git - pakfire.git/commitdiff
cli: snapshots: Commit forgotten files
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Oct 2024 09:01:08 +0000 (09:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Oct 2024 09:01:08 +0000 (09:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/cli/lib/snapshot_update.c [new file with mode: 0644]
src/cli/lib/snapshot_update.h [new file with mode: 0644]

diff --git a/src/cli/lib/snapshot_update.c b/src/cli/lib/snapshot_update.c
new file mode 100644 (file)
index 0000000..2f5fa2e
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <argp.h>
+
+#include <pakfire/pakfire.h>
+
+#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 (file)
index 0000000..021cdf8
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#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 */