prt-get: use correct pkgmk.conf for PKGMK_PACKAGE_DIR (thanks Anton)

git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1862 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
This commit is contained in:
Johannes Winkelmann 2006-09-10 18:22:31 +00:00
parent 205624c78b
commit 9ca92fa2cd
2 changed files with 7 additions and 5 deletions

View File

@ -246,7 +246,7 @@ InstallTransaction::installPackage( const Package* package,
if ( fdlog == -1 ) { if ( fdlog == -1 ) {
return LOG_FILE_FAILURE; return LOG_FILE_FAILURE;
} }
write( fdlog, message.c_str(), message.length()); write( fdlog, message.c_str(), message.length());
write( fdlog, "\n", 1); write( fdlog, "\n", 1);
@ -291,7 +291,7 @@ InstallTransaction::installPackage( const Package* package,
result = PKGMK_FAILURE; result = PKGMK_FAILURE;
} else { } else {
// -- update // -- update
string pkgdest = getPkgDest(); string pkgdest = getPkgDest(parser->installRoot());
if ( pkgdest != "" ) { if ( pkgdest != "" ) {
// TODO: don't manipulate pkgdir // TODO: don't manipulate pkgdir
pkgdir = pkgdest; pkgdir = pkgdest;
@ -582,10 +582,12 @@ InstallTransaction::calcDependencies( )
return SUCCESS; return SUCCESS;
} }
string InstallTransaction::getPkgDest() string InstallTransaction::getPkgDest(const string& installRoot)
{ {
string pkgdest = ""; string pkgdest = "";
FILE* p = popen( ". /etc/pkgmk.conf && echo $PKGMK_PACKAGE_DIR", "r" ); string cmd = ". %s/etc/pkgmk.conf && echo $PKGMK_PACKAGE_DIR";
StringHelper::replaceAll(cmd, "%s", installRoot);
FILE* p = popen(cmd.c_str(), "r");
if ( p ) { if ( p ) {
char line[256]; char line[256];
fgets( line, 256, p ); fgets( line, 256, p );

View File

@ -103,7 +103,7 @@ private:
bool update, bool update,
InstallInfo& info ) const; InstallInfo& info ) const;
static string getPkgDest(); static string getPkgDest(const string& installRoot);
PkgDB* m_pkgDB; PkgDB* m_pkgDB;
DepResolver m_resolver; DepResolver m_resolver;