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
9 @@ -62,6 +62,7 @@ opkg_option_t options[] = {
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
19 @@ -76,6 +76,7 @@ struct opkg_conf
21 int nodeps; /* do not follow dependencies */
27 --- a/libopkg/opkg_install.c
28 +++ b/libopkg/opkg_install.c
33 +#include <sys/stat.h>
37 @@ -189,13 +190,24 @@ static int
38 verify_pkg_installable(pkg_t *pkg)
40 unsigned long kbs_available, pkg_size_kbs;
42 + char *root_dir = NULL;
45 if (conf->force_space || pkg->installed_size == 0)
48 - root_dir = pkg->dest ? pkg->dest->root_dir :
49 - conf->default_dest->root_dir;
52 + if( !strcmp(pkg->dest->name, "root") && conf->overlay_root
53 + && !stat(conf->overlay_root, &s) && (s.st_mode & S_IFDIR) )
54 + root_dir = conf->overlay_root;
56 + root_dir = pkg->dest->root_dir;
60 + root_dir = conf->default_dest->root_dir;
62 kbs_available = get_available_kbytes(root_dir);
64 pkg_size_kbs = (pkg->installed_size + 1023)/1024;