1 This patch adds a new configuration option (overlay_root) specifying
2 what mount point opkg should check for available storage space.
4 Signed-off-by: Nicolas Thill <nico@openwrt.org>
7 --- a/libopkg/opkg_conf.c
8 +++ b/libopkg/opkg_conf.c
10 { "download_only", OPKG_OPT_TYPE_BOOL, &_conf.download_only },
11 { "nodeps", OPKG_OPT_TYPE_BOOL, &_conf.nodeps },
12 { "offline_root", OPKG_OPT_TYPE_STRING, &_conf.offline_root },
13 + { "overlay_root", OPKG_OPT_TYPE_STRING, &_conf.overlay_root },
14 { "proxy_passwd", OPKG_OPT_TYPE_STRING, &_conf.proxy_passwd },
15 { "proxy_user", OPKG_OPT_TYPE_STRING, &_conf.proxy_user },
16 { "query-all", OPKG_OPT_TYPE_BOOL, &_conf.query_all },
17 --- a/libopkg/opkg_conf.h
18 +++ b/libopkg/opkg_conf.h
21 int nodeps; /* do not follow dependences */
27 --- a/libopkg/opkg_install.c
28 +++ b/libopkg/opkg_install.c
30 verify_pkg_installable(pkg_t *pkg)
32 unsigned long kbs_available, pkg_size_kbs;
34 + char *root_dir = NULL;
36 if (conf->force_space || pkg->installed_size == 0)
39 - root_dir = pkg->dest ? pkg->dest->root_dir :
40 - conf->default_dest->root_dir;
41 + if( !pkg->dest || !strcmp(pkg->dest->name, "root") )
42 + root_dir = conf->overlay_root;
44 + root_dir = pkg->dest->root_dir;
47 + root_dir = conf->default_dest->root_dir;
49 kbs_available = get_available_kbytes(root_dir);
51 pkg_size_kbs = (pkg->installed_size + 1023)/1024;