[ar71xx] add missing break statement
[openwrt.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 --- a/libopkg/opkg_conf.c
8 +++ b/libopkg/opkg_conf.c
9 @@ -64,6 +64,7 @@ int opkg_init_options_array(const opkg_c
10 { "offline_root", OPKG_OPT_TYPE_STRING, &conf->offline_root },
11 { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd },
12 { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd },
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 @@ -67,6 +67,7 @@ struct opkg_conf
20 char *offline_root;
21 char *offline_root_pre_script_cmd;
22 char *offline_root_post_script_cmd;
23 + char *overlay_root;
24 int query_all;
25 int verbosity;
26 int noaction;
27 --- a/libopkg/opkg_install.c
28 +++ b/libopkg/opkg_install.c
29 @@ -524,10 +524,13 @@ static int verify_pkg_installable(opkg_c
30 * my diddling with the .opk file size below isn't going to cut it.
31 * 3) return a proper error code instead of 1
32 */
33 - int comp_size, blocks_available;
34 -
35 + int comp_size, blocks_available = -1;
36 +
37 if (!conf->force_space && pkg->installed_size != NULL) {
38 - blocks_available = get_available_blocks(conf->default_dest->root_dir);
39 + if (conf->overlay_root != NULL)
40 + blocks_available = get_available_blocks(conf->overlay_root);
41 + if (blocks_available < 0)
42 + blocks_available = get_available_blocks(conf->default_dest->root_dir);
43
44 comp_size = strtoul(pkg->installed_size, NULL, 0);
45 /* round up a blocks count without doing fancy-but-slow casting jazz */
46 --- a/libopkg/opkg_utils.c
47 +++ b/libopkg/opkg_utils.c
48 @@ -30,10 +30,8 @@ int get_available_blocks(char * filesyst
49 {
50 struct statfs sfs;
51
52 - if(statfs(filesystem, &sfs)){
53 - fprintf(stderr, "bad statfs\n");
54 - return 0;
55 - }
56 + if(statfs(filesystem, &sfs))
57 + return -1;
58 /* fprintf(stderr, "reported fs type %x\n", sfs.f_type); */
59 return ((sfs.f_bavail * sfs.f_bsize) / 1024);
60 }
This page took 0.04612 seconds and 5 git commands to generate.