add a patch helping available storage space detection, remove workaround from [13611...
[openwrt-10.03/.git] / package / opkg / patches / 003-fs_overlay_support.patch
1 This patch adds a new configuration option (overlay_root) specifying 
2 what mount point opkg should check for available storage space.
3
4 Signed-off-by: Nicolas Thill <nico@openwrt.org>
5
6
7 diff -ruN opkg-4564-old/libopkg/opkg_conf.c opkg-4564-new/libopkg/opkg_conf.c
8 --- opkg-4564-old/libopkg/opkg_conf.c   2008-08-04 19:18:51.000000000 +0200
9 +++ opkg-4564-new/libopkg/opkg_conf.c   2008-12-12 02:26:35.000000000 +0100
10 @@ -64,6 +64,7 @@
11           { "offline_root", OPKG_OPT_TYPE_STRING, &conf->offline_root },
12           { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd },
13           { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd },
14 +         { "overlay_root", OPKG_OPT_TYPE_STRING, &conf->overlay_root },
15           { "proxy_passwd", OPKG_OPT_TYPE_STRING, &conf->proxy_passwd },
16           { "proxy_user", OPKG_OPT_TYPE_STRING, &conf->proxy_user },
17           { "query-all", OPKG_OPT_TYPE_BOOL, &conf->query_all },
18 diff -ruN opkg-4564-old/libopkg/opkg_conf.h opkg-4564-new/libopkg/opkg_conf.h
19 --- opkg-4564-old/libopkg/opkg_conf.h   2008-08-04 19:18:51.000000000 +0200
20 +++ opkg-4564-new/libopkg/opkg_conf.h   2008-12-12 02:25:33.000000000 +0100
21 @@ -67,6 +67,7 @@
22       char *offline_root;
23       char *offline_root_pre_script_cmd;
24       char *offline_root_post_script_cmd;
25 +     char *overlay_root;
26       int query_all;
27       int verbosity;
28       int noaction;
29 Binary files opkg-4564-old/libopkg/opkg_conf.o and opkg-4564-new/libopkg/opkg_conf.o differ
30 diff -ruN opkg-4564-old/libopkg/opkg_install.c opkg-4564-new/libopkg/opkg_install.c
31 --- opkg-4564-old/libopkg/opkg_install.c        2008-08-04 19:18:51.000000000 +0200
32 +++ opkg-4564-new/libopkg/opkg_install.c        2008-12-12 02:29:13.000000000 +0100
33 @@ -525,9 +525,15 @@
34       * 3) return a proper error code instead of 1
35       */
36       int comp_size, blocks_available;
37 +     char *root;
38      
39       if (!conf->force_space && pkg->installed_size != NULL) {
40 -         blocks_available = get_available_blocks(conf->default_dest->root_dir);
41 +          if (conf->overlay_root != NULL) {
42 +               root = conf->overlay_root;
43 +          } else {
44 +               root = conf->default_dest->root_dir;
45 +          }
46 +         blocks_available = get_available_blocks(root);
47  
48           comp_size = strtoul(pkg->installed_size, NULL, 0);
49           /* round up a blocks count without doing fancy-but-slow casting jazz */