fix misc compile warnings

document the interaction between --install-root and 'runscripts yes'
This commit is contained in:
John McQuah 2023-06-19 14:44:03 -04:00
parent d9a0d39b60
commit 934e044f86
8 changed files with 25 additions and 30 deletions

View File

@ -549,19 +549,16 @@ the requested packages onto a different directory than '/'. In daily usage,
this option is not required; it's primarily interesting if you're developing this option is not required; it's primarily interesting if you're developing
an independent installation. an independent installation.
Some pre- or post-install scripts might not have the intended effect if Pre- and post-install scripts will not be executed if the target root directory
invoked as lacks a copy of the ports tree. So if you're maintaining an installation on a
.B chroot <dir> /bin/sh <path/to/script> volume mounted somewhere other than '/', it's not enough to have the line
(the naive way to respect --install-root). .B runscripts yes
So if you're maintaining an installation on a volume mounted somewhere in your prt-get.conf; you also have to ensure that the pre- and post-install
other than '/', it might be safer to ensure that your \fBprt\-get.conf(5)\fP scripts can be found in the same location relative to <dir>.
has the line
.B runscripts no
and then run any pre- or post-install scripts by hand.
The setting for --install-root determines which package database is used for The setting for --install-root determines which package database is used for
reading/writing (so <dir>/var/lib/pkg/db must exist), and where the pkg.tar.?z reading/writing (so <dir>/var/lib/pkg/db must exist), and where the pkg.tar.?z
archives get unpacked, but the relevant prt\-get.conf and ports tree are those archives get unpacked, but the relevant prt-get.conf and ports tree are those
on the parent filesystem. Therefore it is not necessary for <dir> to contain on the parent filesystem. Therefore it is not necessary for <dir> to contain
its own copy of the ports tree, or even a copy of prt-get.conf. its own copy of the ports tree, or even a copy of prt-get.conf.
However, if <dir>/etc/pkgadd.conf exists and is different from /etc/pkgadd.conf, However, if <dir>/etc/pkgadd.conf exists and is different from /etc/pkgadd.conf,

View File

@ -313,7 +313,7 @@ InstallTransaction::installPackage( const Package* package,
// -- pre-install // -- pre-install
struct stat statData; struct stat statData;
if ((parser->execPreInstall() || m_config->runScripts()) && if ((parser->execPreInstall() || m_config->runScripts()) &&
stat((pkgdir + "/" + "pre-install").c_str(), &statData) == 0) { stat((parser->installRoot() + pkgdir + "/" + "pre-install").c_str(), &statData) == 0) {
Process preProc( runscriptCommand, Process preProc( runscriptCommand,
pkgdir + "/" + "pre-install", pkgdir + "/" + "pre-install",
fdlog ); fdlog );
@ -421,9 +421,9 @@ InstallTransaction::installPackage( const Package* package,
} else { } else {
// exec post install // exec post install
if ((parser->execPostInstall() || m_config->runScripts() ) && if ((parser->execPostInstall() || m_config->runScripts() ) &&
stat((package->path() + "/" + package->name() + stat((parser->installRoot() + package->path()
"/" + "post-install").c_str(), &statData) + "/" + package->name() + "/" + "post-install").c_str(),
== 0) { &statData) == 0) {
// Work around the pkgdir variable change // Work around the pkgdir variable change
Process postProc( runscriptCommand, Process postProc( runscriptCommand,
package->path() + "/" + package->name()+ package->path() + "/" + package->name()+
@ -717,7 +717,7 @@ string InstallTransaction::getPkgmkSettingFromFile(const string& setting, const
if (p) { if (p) {
fgets(line, 256, p); fgets(line, 256, p);
value = StringHelper::stripWhiteSpace(line); value = StringHelper::stripWhiteSpace(line);
fclose(p); pclose(p);
} }
} }

View File

@ -124,7 +124,7 @@ const string& Package::maintainer() const
} }
/*! \return whether or not this package has a readme file */ /*! \return whether or not this package has a readme file */
const bool Package::hasReadme() const bool Package::hasReadme() const
{ {
load(); load();
return m_data->hasReadme; return m_data->hasReadme;
@ -137,12 +137,12 @@ string Package::versionReleaseString() const
return m_data->versionReleaseString; return m_data->versionReleaseString;
} }
const bool Package::hasPreInstall() const bool Package::hasPreInstall() const
{ {
return m_data->hasPreInstall; return m_data->hasPreInstall;
} }
const bool Package::hasPostInstall() const bool Package::hasPostInstall() const
{ {
return m_data->hasPostInstall; return m_data->hasPostInstall;
} }
@ -345,11 +345,9 @@ void Package::expandShellCommands(std::string& input,
pos = 0; pos = 0;
while ((pos = input.find(startTag[i], pos)) != string::npos) { while ((pos = input.find(startTag[i], pos)) != string::npos) {
if (unameBuf.release) {
input = replaceAll(input, input = replaceAll(input,
startTag[i] + "uname -r" + endTag[i], startTag[i] + "uname -r" + endTag[i],
unameBuf.release); unameBuf.release);
}
dpos = input.find(startTag[i] + "date"); dpos = input.find(startTag[i] + "date");
if (dpos != string::npos) { if (dpos != string::npos) {

View File

@ -52,9 +52,9 @@ public:
const std::string& url() const; const std::string& url() const;
const std::string& optionals() const; const std::string& optionals() const;
const std::string& maintainer() const; const std::string& maintainer() const;
const bool hasReadme() const; bool hasReadme() const;
const bool hasPreInstall() const; bool hasPreInstall() const;
const bool hasPostInstall() const; bool hasPostInstall() const;
std::string versionReleaseString() const; std::string versionReleaseString() const;

View File

@ -1676,7 +1676,7 @@ void PrtGet::current()
m_returnValue = 1; m_returnValue = 1;
} }
SignalHandler::HandlerResult PrtGet::handleSignal( int signal ) SignalHandler::HandlerResult PrtGet::handleSignal()
{ {
// TODO: second argument could also be true: // TODO: second argument could also be true:
// TODO: kill installtransaction // TODO: kill installtransaction

View File

@ -92,7 +92,7 @@ public:
int returnValue() const; int returnValue() const;
SignalHandler::HandlerResult handleSignal( int signal ); SignalHandler::HandlerResult handleSignal();
protected: protected:

View File

@ -36,7 +36,7 @@ void SignalDispatcher::dispatch( int signalNumber )
map<int, SignalHandler*>::iterator it = map<int, SignalHandler*>::iterator it =
SignalDispatcher::instance()->m_signalHandlers.find( signalNumber ); SignalDispatcher::instance()->m_signalHandlers.find( signalNumber );
if ( it != SignalDispatcher::instance()->m_signalHandlers.end() ) { if ( it != SignalDispatcher::instance()->m_signalHandlers.end() ) {
it->second->handleSignal( signalNumber ); it->second->handleSignal();
} else { } else {
cerr << "prt-get: caught signal " << signalNumber << endl; cerr << "prt-get: caught signal " << signalNumber << endl;
} }

View File

@ -28,7 +28,7 @@ public:
EXIT, /*!< signal handled, exit now */ EXIT, /*!< signal handled, exit now */
CONTINUE /*!< signal handled, don't exit */ CONTINUE /*!< signal handled, don't exit */
}; };
virtual HandlerResult handleSignal( int signalNumber ) = 0; virtual HandlerResult handleSignal() = 0;
}; };
/*! /*!