diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-10-03 22:15:39 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-10-03 22:15:39 +0000 |
commit | 95773d8fb6672d7cf35c30772761402cd88259bd (patch) | |
tree | 9bf132682a320a7c3a216dba37a2079455e512a2 /package/opkg | |
parent | b592e5c373b8ffd1428cf1c8f6fd4fa2c116c036 (diff) |
[package] opkg: implement "list-changed-conffiles" command, based on patch by Yann Lopez <yann.lopez@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23210 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/opkg')
-rw-r--r-- | package/opkg/Makefile | 2 | ||||
-rw-r--r-- | package/opkg/patches/013-add-list-changed-conffiles.patch | 70 |
2 files changed, 71 insertions, 1 deletions
diff --git a/package/opkg/Makefile b/package/opkg/Makefile index df5492d24..1fcd196cf 100644 --- a/package/opkg/Makefile +++ b/package/opkg/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=opkg PKG_REV:=563 PKG_VERSION:=$(PKG_REV) -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=svn PKG_SOURCE_VERSION:=$(PKG_REV) diff --git a/package/opkg/patches/013-add-list-changed-conffiles.patch b/package/opkg/patches/013-add-list-changed-conffiles.patch new file mode 100644 index 000000000..1824ceaa7 --- /dev/null +++ b/package/opkg/patches/013-add-list-changed-conffiles.patch @@ -0,0 +1,70 @@ +--- a/libopkg/opkg_cmd.c ++++ b/libopkg/opkg_cmd.c +@@ -617,6 +617,39 @@ opkg_list_installed_cmd(int argc, char * + } + + static int ++opkg_list_changed_conffiles_cmd(int argc, char **argv) ++{ ++ int i ; ++ pkg_vec_t *available; ++ pkg_t *pkg; ++ char *pkg_name = NULL; ++ conffile_list_elt_t *iter; ++ conffile_t *cf; ++ ++ if (argc > 0) { ++ pkg_name = argv[0]; ++ } ++ available = pkg_vec_alloc(); ++ pkg_hash_fetch_all_installed(available); ++ pkg_vec_sort(available, pkg_compare_names); ++ for (i=0; i < available->len; i++) { ++ pkg = available->pkgs[i]; ++ /* if we have package name or pattern and pkg does not match, then skip it */ ++ if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) ++ continue; ++ if (nv_pair_list_empty(&pkg->conffiles)) ++ continue; ++ for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) { ++ cf = (conffile_t *)iter->data; ++ if (cf->name && cf->value && conffile_has_been_modified(cf)) ++ printf("%s\n", cf->name); ++ } ++ } ++ pkg_vec_free(available); ++ return 0; ++} ++ ++static int + opkg_list_upgradable_cmd(int argc, char **argv) + { + struct active_list *head = prepare_upgrade_list(); +@@ -1188,6 +1221,8 @@ static opkg_cmd_t cmds[] = { + {"list-installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE}, + {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd, PFM_SOURCE}, + {"list-upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd, PFM_SOURCE}, ++ {"list_changed_conffiles", 0, (opkg_cmd_fun_t)opkg_list_changed_conffiles_cmd, PFM_SOURCE}, ++ {"list-changed-conffiles", 0, (opkg_cmd_fun_t)opkg_list_changed_conffiles_cmd, PFM_SOURCE}, + {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd, 0}, + {"flag", 1, (opkg_cmd_fun_t)opkg_flag_cmd, PFM_DESCRIPTION|PFM_SOURCE}, + {"status", 0, (opkg_cmd_fun_t)opkg_status_cmd, PFM_DESCRIPTION|PFM_SOURCE}, +--- a/src/opkg-cl.c ++++ b/src/opkg-cl.c +@@ -228,6 +228,7 @@ usage() + printf("\tlist List available packages\n"); + printf("\tlist-installed List installed packages\n"); + printf("\tlist-upgradable List installed and upgradable packages\n"); ++ printf("\tlist-changed-conffiles List user modified configuration files\n"); + printf("\tfiles <pkg> List files belonging to <pkg>\n"); + printf("\tsearch <file|regexp> List package providing <file>\n"); + printf("\tinfo [pkg|regexp] Display all info for <pkg>\n"); +@@ -331,6 +332,8 @@ main(int argc, char *argv[]) + !strcmp(cmd_name,"compare-versions") || + !strcmp(cmd_name,"list_installed") || + !strcmp(cmd_name,"list-installed") || ++ !strcmp(cmd_name,"list_changed_conffiles") || ++ !strcmp(cmd_name,"list-changed-conffiles") || + !strcmp(cmd_name,"status") ) + noreadfeedsfile = 1; + |