summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_install.c
diff options
context:
space:
mode:
authorgraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2011-02-13 21:46:01 (EST)
committer graham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2011-02-13 21:46:01 (EST)
commit0f54da55b8717543b08596e58c022ae49e70a184 (patch)
tree6fe6026cf028f763593a156a349e79969d7df6e9 /libopkg/opkg_install.c
parent2e7f79df655f82bf42ed2a06fea1a036d3d37024 (diff)
Add overlay_root config option. Opkg checks this location for available space.
This option is useful in the case where root is mounted ro, and another rw filesystem is overlaid on top with e.g. mini_fo. From Nicolas Thill via OpenWrt. git-svn-id: http://opkg.googlecode.com/svn/trunk@601 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_install.c')
-rw-r--r--libopkg/opkg_install.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 7838875..74a2ce1 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -21,6 +21,7 @@
#include <time.h>
#include <signal.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "pkg.h"
#include "pkg_hash.h"
@@ -192,13 +193,24 @@ static int
verify_pkg_installable(pkg_t *pkg)
{
unsigned long kbs_available, pkg_size_kbs;
- char *root_dir;
+ char *root_dir = NULL;
+ struct stat s;
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)
+ {
+ if (!strcmp(pkg->dest->name, "root") && conf->overlay_root
+ && !stat(conf->overlay_root, &s) && (s.st_mode & S_IFDIR))
+ 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;