summaryrefslogtreecommitdiffstats
path: root/package/opkg/patches/003-fs_overlay_support.patch
blob: aa8b83ba6e70380fc7dc33bf3ed076f840806940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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>


--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -58,6 +58,7 @@
 	  { "noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction },
 	  { "nodeps", OPKG_OPT_TYPE_BOOL, &_conf.nodeps },
 	  { "offline_root", OPKG_OPT_TYPE_STRING, &_conf.offline_root },
+	  { "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 },
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -74,6 +74,7 @@
      int check_signature;
      int nodeps; /* do not follow dependences */
      char *offline_root;
+     char *overlay_root;
      int query_all;
      int verbosity;
      int noaction;
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -189,13 +189,19 @@
 verify_pkg_installable(pkg_t *pkg)
 {
 	unsigned long kbs_available, pkg_size_kbs;
-	char *root_dir;
+	char *root_dir = NULL;
 
 	if (conf->force_space || pkg->installed_size == 0)
 		return 0;
 
-	root_dir = pkg->dest ? pkg->dest->root_dir :
-						conf->default_dest->root_dir;
+	if( !pkg->dest || !strcmp(pkg->dest->name, "root") )
+		root_dir = conf->overlay_root;
+	else
+		root_dir = pkg->dest->root_dir;
+
+	if( !root_dir )
+		root_dir = conf->default_dest->root_dir;
+
 	kbs_available = get_available_kbytes(root_dir);
 
 	pkg_size_kbs = (pkg->installed_size + 1023)/1024;