2008-12-15 13:11:12 +00:00
|
|
|
This patch adds a new configuration option (overlay_root) specifying
|
|
|
|
what mount point opkg should check for available storage space.
|
|
|
|
|
|
|
|
Signed-off-by: Nicolas Thill <nico@openwrt.org>
|
|
|
|
|
|
|
|
|
2008-12-21 19:52:14 +00:00
|
|
|
--- a/libopkg/opkg_conf.c
|
|
|
|
+++ b/libopkg/opkg_conf.c
|
2009-11-11 21:42:05 +00:00
|
|
|
@@ -72,6 +72,7 @@
|
2009-08-06 20:08:27 +00:00
|
|
|
{ "offline_root_path", OPKG_OPT_TYPE_STRING, &conf->offline_root_path },
|
2008-12-15 13:11:12 +00:00
|
|
|
{ "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd },
|
|
|
|
{ "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd },
|
|
|
|
+ { "overlay_root", OPKG_OPT_TYPE_STRING, &conf->overlay_root },
|
|
|
|
{ "proxy_passwd", OPKG_OPT_TYPE_STRING, &conf->proxy_passwd },
|
|
|
|
{ "proxy_user", OPKG_OPT_TYPE_STRING, &conf->proxy_user },
|
|
|
|
{ "query-all", OPKG_OPT_TYPE_BOOL, &conf->query_all },
|
2008-12-21 19:52:14 +00:00
|
|
|
--- a/libopkg/opkg_conf.h
|
|
|
|
+++ b/libopkg/opkg_conf.h
|
2009-11-11 21:42:05 +00:00
|
|
|
@@ -70,6 +70,7 @@
|
2009-08-06 20:08:27 +00:00
|
|
|
char *offline_root_path;
|
2008-12-15 13:11:12 +00:00
|
|
|
char *offline_root_pre_script_cmd;
|
|
|
|
char *offline_root_post_script_cmd;
|
|
|
|
+ char *overlay_root;
|
|
|
|
int query_all;
|
|
|
|
int verbosity;
|
|
|
|
int noaction;
|
2008-12-21 19:52:14 +00:00
|
|
|
--- a/libopkg/opkg_install.c
|
|
|
|
+++ b/libopkg/opkg_install.c
|
2009-11-11 21:42:05 +00:00
|
|
|
@@ -470,12 +470,15 @@
|
2008-12-21 19:52:14 +00:00
|
|
|
* my diddling with the .opk file size below isn't going to cut it.
|
2008-12-15 13:11:12 +00:00
|
|
|
* 3) return a proper error code instead of 1
|
|
|
|
*/
|
2008-12-21 19:52:14 +00:00
|
|
|
- int comp_size, blocks_available;
|
|
|
|
+ int comp_size, blocks_available = -1;
|
2009-08-06 20:08:27 +00:00
|
|
|
char *root_dir;
|
|
|
|
|
2008-12-15 13:11:12 +00:00
|
|
|
if (!conf->force_space && pkg->installed_size != NULL) {
|
2009-08-06 20:08:27 +00:00
|
|
|
root_dir = pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir;
|
|
|
|
- blocks_available = get_available_blocks(root_dir);
|
|
|
|
+ if (conf->overlay_root != NULL)
|
|
|
|
+ blocks_available = get_available_blocks(conf->overlay_root);
|
|
|
|
+ if (blocks_available < 0)
|
|
|
|
+ blocks_available = get_available_blocks(root_dir);
|
2008-12-15 13:11:12 +00:00
|
|
|
|
|
|
|
comp_size = strtoul(pkg->installed_size, NULL, 0);
|
|
|
|
/* round up a blocks count without doing fancy-but-slow casting jazz */
|
2008-12-21 19:52:14 +00:00
|
|
|
--- a/libopkg/opkg_utils.c
|
|
|
|
+++ b/libopkg/opkg_utils.c
|
2009-11-11 21:42:05 +00:00
|
|
|
@@ -31,10 +31,8 @@
|
2008-12-21 19:52:14 +00:00
|
|
|
{
|
2009-08-06 20:08:27 +00:00
|
|
|
struct statfs sfs;
|
2008-12-21 19:52:14 +00:00
|
|
|
|
2009-08-06 20:08:27 +00:00
|
|
|
- if(statfs(filesystem, &sfs)){
|
|
|
|
- fprintf(stderr, "bad statfs\n");
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
+ if(statfs(filesystem, &sfs))
|
|
|
|
+ return -1;
|
|
|
|
/* fprintf(stderr, "reported fs type %x\n", sfs.f_type); */
|
|
|
|
|
|
|
|
// Actually ((sfs.f_bavail * sfs.f_bsize) / 1024)
|