Add overlay_root config option. Opkg checks this location for available space.
authorgraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 14 Feb 2011 02:46:01 +0000 (02:46 +0000)
committergraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 14 Feb 2011 02:46:01 +0000 (02:46 +0000)
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

libopkg/opkg_conf.c
libopkg/opkg_conf.h
libopkg/opkg_install.c

index acac1b49894d7e92b1baf2f6aaf283460f9d3cc7..864d2ac30992c43a6b9478dbd93acdb6b929f391 100644 (file)
@@ -63,6 +63,7 @@ opkg_option_t options[] = {
          { "download_only", OPKG_OPT_TYPE_BOOL, &_conf.download_only },
          { "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 },
index af6b9ab21cab6c9e5f828800f7cd7b52df99cdb4..0340ff29061681a542c9156dbc83386474d4cf30 100644 (file)
@@ -79,6 +79,7 @@ struct opkg_conf
      int check_signature;
      int nodeps; /* do not follow dependencies */
      char *offline_root;
+     char *overlay_root;
      int query_all;
      int verbosity;
      int noaction;
index 783887509fad84d7b92786fb1f87e9f475ce19f5..74a2ce115a62e8496baaa2d3af1c3e57890f1705 100644 (file)
@@ -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;