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
an independent installation.
Some pre- or post-install scripts might not have the intended effect if
invoked as
.B chroot <dir> /bin/sh <path/to/script>
(the naive way to respect --install-root).
So if you're maintaining an installation on a volume mounted somewhere
other than '/', it might be safer to ensure that your \fBprt\-get.conf(5)\fP
has the line
.B runscripts no
and then run any pre- or post-install scripts by hand.
Pre- and post-install scripts will not be executed if the target root directory
lacks a copy of the ports tree. So if you're maintaining an installation on a
volume mounted somewhere other than '/', it's not enough to have the line
.B runscripts yes
in your prt-get.conf; you also have to ensure that the pre- and post-install
scripts can be found in the same location relative to <dir>.
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
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
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,

View File

@ -313,7 +313,7 @@ InstallTransaction::installPackage( const Package* package,
// -- pre-install
struct stat statData;
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,
pkgdir + "/" + "pre-install",
fdlog );
@ -421,9 +421,9 @@ InstallTransaction::installPackage( const Package* package,
} else {
// exec post install
if ((parser->execPostInstall() || m_config->runScripts() ) &&
stat((package->path() + "/" + package->name() +
"/" + "post-install").c_str(), &statData)
== 0) {
stat((parser->installRoot() + package->path()
+ "/" + package->name() + "/" + "post-install").c_str(),
&statData) == 0) {
// Work around the pkgdir variable change
Process postProc( runscriptCommand,
package->path() + "/" + package->name()+
@ -717,7 +717,7 @@ string InstallTransaction::getPkgmkSettingFromFile(const string& setting, const
if (p) {
fgets(line, 256, p);
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 */
const bool Package::hasReadme() const
bool Package::hasReadme() const
{
load();
return m_data->hasReadme;
@ -137,12 +137,12 @@ string Package::versionReleaseString() const
return m_data->versionReleaseString;
}
const bool Package::hasPreInstall() const
bool Package::hasPreInstall() const
{
return m_data->hasPreInstall;
}
const bool Package::hasPostInstall() const
bool Package::hasPostInstall() const
{
return m_data->hasPostInstall;
}
@ -345,11 +345,9 @@ void Package::expandShellCommands(std::string& input,
pos = 0;
while ((pos = input.find(startTag[i], pos)) != string::npos) {
if (unameBuf.release) {
input = replaceAll(input,
startTag[i] + "uname -r" + endTag[i],
unameBuf.release);
}
input = replaceAll(input,
startTag[i] + "uname -r" + endTag[i],
unameBuf.release);
dpos = input.find(startTag[i] + "date");
if (dpos != string::npos) {

View File

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

View File

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

View File

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

View File

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

View File

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