[ar7] refresh patches and remove trailing whitespaces
[openwrt.git] / package / opkg / patches / 003-fs_overlay_support.patch
index 63a34cf..63933bd 100644 (file)
@@ -4,46 +4,61 @@ what mount point opkg should check for available storage space.
 Signed-off-by: Nicolas Thill <nico@openwrt.org>
 
 
 Signed-off-by: Nicolas Thill <nico@openwrt.org>
 
 
-diff -ruN opkg-4564-old/libopkg/opkg_conf.c opkg-4564-new/libopkg/opkg_conf.c
---- opkg-4564-old/libopkg/opkg_conf.c  2008-08-04 19:18:51.000000000 +0200
-+++ opkg-4564-new/libopkg/opkg_conf.c  2008-12-12 02:26:35.000000000 +0100
-@@ -64,6 +64,7 @@
-         { "offline_root", OPKG_OPT_TYPE_STRING, &conf->offline_root },
-         { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd },
-         { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd },
-+        { "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 },
-diff -ruN opkg-4564-old/libopkg/opkg_conf.h opkg-4564-new/libopkg/opkg_conf.h
---- opkg-4564-old/libopkg/opkg_conf.h  2008-08-04 19:18:51.000000000 +0200
-+++ opkg-4564-new/libopkg/opkg_conf.h  2008-12-12 02:25:33.000000000 +0100
-@@ -67,6 +67,7 @@
+--- a/libopkg/opkg_conf.c
++++ b/libopkg/opkg_conf.c
+@@ -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 },
+--- a/libopkg/opkg_conf.h
++++ b/libopkg/opkg_conf.h
+@@ -78,6 +78,7 @@ struct opkg_conf
+      int check_signature;
+      int nodeps; /* do not follow dependencies */
       char *offline_root;
       char *offline_root;
-      char *offline_root_pre_script_cmd;
-      char *offline_root_post_script_cmd;
 +     char *overlay_root;
       int query_all;
       int verbosity;
       int noaction;
 +     char *overlay_root;
       int query_all;
       int verbosity;
       int noaction;
-Binary files opkg-4564-old/libopkg/opkg_conf.o and opkg-4564-new/libopkg/opkg_conf.o differ
-diff -ruN opkg-4564-old/libopkg/opkg_install.c opkg-4564-new/libopkg/opkg_install.c
---- opkg-4564-old/libopkg/opkg_install.c       2008-08-04 19:18:51.000000000 +0200
-+++ opkg-4564-new/libopkg/opkg_install.c       2008-12-12 02:29:13.000000000 +0100
-@@ -525,9 +525,15 @@
-      * 3) return a proper error code instead of 1
-      */
-      int comp_size, blocks_available;
-+     char *root;
-     
-      if (!conf->force_space && pkg->installed_size != NULL) {
--        blocks_available = get_available_blocks(conf->default_dest->root_dir);
-+          if (conf->overlay_root != NULL) {
-+               root = conf->overlay_root;
-+          } else {
-+               root = conf->default_dest->root_dir;
-+          }
-+        blocks_available = get_available_blocks(root);
+--- 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>
  
  
-         comp_size = strtoul(pkg->installed_size, NULL, 0);
-         /* round up a blocks count without doing fancy-but-slow casting jazz */ 
+ #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;
This page took 0.027981 seconds and 4 git commands to generate.