firmware-utils/mktplinkfw: add support for the TL-MR3220 v1
[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 @@ -63,6 +63,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 @@ -78,6 +78,7 @@ struct opkg_conf
20 int check_signature;
21 int nodeps; /* do not follow dependencies */
22 char *offline_root;
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 @@ -21,6 +21,7 @@
30 #include <time.h>
31 #include <signal.h>
32 #include <unistd.h>
33 +#include <sys/stat.h>
34
35 #include "pkg.h"
36 #include "pkg_hash.h"
37 @@ -192,13 +193,24 @@ static int
38 verify_pkg_installable(pkg_t *pkg)
39 {
40 unsigned long kbs_available, pkg_size_kbs;
41 - char *root_dir;
42 + char *root_dir = NULL;
43 + struct stat s;
44
45 if (conf->force_space || pkg->installed_size == 0)
46 return 0;
47
48 - root_dir = pkg->dest ? pkg->dest->root_dir :
49 - conf->default_dest->root_dir;
50 + if( pkg->dest )
51 + {
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;
55 + else
56 + root_dir = pkg->dest->root_dir;
57 + }
58 +
59 + if( !root_dir )
60 + root_dir = conf->default_dest->root_dir;
61 +
62 kbs_available = get_available_kbytes(root_dir);
63
64 pkg_size_kbs = (pkg->installed_size + 1023)/1024;
This page took 0.065796 seconds and 5 git commands to generate.