1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 00:30:16 +02:00

[package] opkg: fallback to dest->root_dir if specified overlay_root does not exist on filesystem (#6498)

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19121 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2010-01-13 20:21:39 +00:00
parent 0466bd77cf
commit 7d33089d1a

View File

@ -26,22 +26,35 @@ Signed-off-by: Nicolas Thill <nico@openwrt.org>
int noaction; int noaction;
--- a/libopkg/opkg_install.c --- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c
@@ -189,13 +189,19 @@ @@ -21,6 +21,7 @@
#include <time.h>
#include <signal.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "pkg.h"
#include "pkg_hash.h"
@@ -189,13 +190,24 @@
verify_pkg_installable(pkg_t *pkg) verify_pkg_installable(pkg_t *pkg)
{ {
unsigned long kbs_available, pkg_size_kbs; unsigned long kbs_available, pkg_size_kbs;
- char *root_dir; - char *root_dir;
+ char *root_dir = NULL; + char *root_dir = NULL;
+ struct stat s;
if (conf->force_space || pkg->installed_size == 0) if (conf->force_space || pkg->installed_size == 0)
return 0; return 0;
- root_dir = pkg->dest ? pkg->dest->root_dir : - root_dir = pkg->dest ? pkg->dest->root_dir :
- conf->default_dest->root_dir; - conf->default_dest->root_dir;
+ if( !pkg->dest || !strcmp(pkg->dest->name, "root") ) + if( pkg->dest )
+ root_dir = conf->overlay_root; + {
+ else + if( !strcmp(pkg->dest->name, "root") && conf->overlay_root
+ root_dir = pkg->dest->root_dir; + && !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 ) + if( !root_dir )
+ root_dir = conf->default_dest->root_dir; + root_dir = conf->default_dest->root_dir;