mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-04 07:48:47 +00:00
Add new bundle-list sub-command
This is a new sub-command for swupd called "bundle-list", this command will show which bundles are installed in the local system. This information is obtained reading /usr/share/clear/bundles path in local filesystem. Signed-off-by: Mario Alfredo Carrillo Arevalo <mario.alfredo.c.arevalo@intel.com>
This commit is contained in:
committed by
tmarcu
parent
c244d36be3
commit
bcce348e1b
@@ -13,6 +13,7 @@ swupd_SOURCES = \
|
||||
$(swupd_verify_SOURCES) \
|
||||
$(clr_bundle_add_SOURCES) \
|
||||
$(clr_bundle_rm_SOURCES) \
|
||||
$(clr_bundle_ls_SOURCES) \
|
||||
$(swupd_search_SOURCES)
|
||||
|
||||
check_PROGRAMS = \
|
||||
@@ -65,6 +66,7 @@ swupd_search_SOURCES = src/search.c
|
||||
|
||||
clr_bundle_add_SOURCES = src/clr_bundle_add.c
|
||||
clr_bundle_rm_SOURCES = src/clr_bundle_rm.c
|
||||
clr_bundle_ls_SOURCES = src/clr_bundle_ls.c
|
||||
|
||||
swupd_hashdump_SOURCES = src/hashdump.c
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
extern int bundle_add_main(int argc, char **argv);
|
||||
extern int bundle_remove_main(int argc, char **argv);
|
||||
extern int bundle_list_main(int argc, char **argv);
|
||||
extern int hashdump_main(int argc, char **argv);
|
||||
extern int update_main(int argc, char **argv);
|
||||
extern int verify_main(int argc, char **argv);
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Software Updater - client side
|
||||
*
|
||||
* Copyright © 2012-2016 Intel Corporation.
|
||||
*
|
||||
* 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, version 2 or later of the License.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors:
|
||||
* Mario Alfredo Carrillo Arevalo <mario.alfredo.c.arevalo@intel.com>
|
||||
* Jaime A. Garcia <jaime.garcia.naranjo@linux.intel.com>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "swupd.h"
|
||||
#include "config.h"
|
||||
|
||||
int bundle_list_main(int argc, char **argv)
|
||||
{
|
||||
int current_version;
|
||||
int lock_fd;
|
||||
int ret;
|
||||
struct list *list_bundles = NULL;
|
||||
struct list *item = NULL;
|
||||
|
||||
copyright_header("bundle list");
|
||||
|
||||
ret = swupd_init(&lock_fd);
|
||||
if (ret != 0) {
|
||||
printf("Error: Failed updater initialization. Exiting now\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
current_version = get_current_version(path_prefix);
|
||||
if (current_version < 0) {
|
||||
printf("Error: Unable to determine current OS version\n");
|
||||
v_lockfile(lock_fd);
|
||||
return ECURRENT_VERSION;
|
||||
}
|
||||
|
||||
read_local_bundles(&list_bundles);
|
||||
|
||||
item = list_head(list_bundles);
|
||||
|
||||
while (item) {
|
||||
printf("%s\n", (char *)item->data);
|
||||
item = item->next;
|
||||
}
|
||||
|
||||
printf("Current OS version: %d\n", current_version);
|
||||
|
||||
list_free_list(list_bundles);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -36,6 +36,7 @@ struct subcmd {
|
||||
static struct subcmd commands[] = {
|
||||
{ "bundle-add", "Install a new bundle", bundle_add_main },
|
||||
{ "bundle-remove", "Uninstall a bundle", bundle_remove_main },
|
||||
{ "bundle-list", "List installed bundles", bundle_list_main },
|
||||
{ "hashdump", "Dumps the HMAC hash of a file", hashdump_main },
|
||||
{ "update", "Update to latest OS version", update_main },
|
||||
{ "verify", "Verify content for OS version", verify_main },
|
||||
|
||||
Reference in New Issue
Block a user