#include "system.h"
#include <signal.h>
#include <sys/signal.h>
#include <rpmio_internal.h>
#include <rpmlib.h>
#include <rpmmacro.h>
#include <rpmurl.h>
#include "cpio.h"
#include "fsm.h"
#include "psm.h"
#include "rpmds.h"
#include "rpmfi.h"
#include "rpmte.h"
#include "rpmts.h"
#include "rpmlead.h"
#include "signature.h"
#include "legacy.h"
#include "ugid.h"
#include "misc.h"
#include "rpmdb.h"
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | psmtbl_s |
struct | sigtbl_s |
struct | tagMacro |
Macros to be defined from per-header tag values. More... | |
Defines | |
#define | _RPMFI_INTERNAL |
#define | _RPMTE_INTERNAL |
#define | _RPMTS_INTERNAL |
#define | _PSM_DEBUG 0 |
Functions | |
int | rpmVersionCompare (Header first, Header second) |
Compare headers to determine which header is "newer". | |
int | rpmInstallLoadMacros (rpmfi fi, Header h) |
Define per-header macros. | |
rpmRC | markReplacedFiles (const rpmpsm psm) |
Mark files in database shared with this package as "replaced". | |
rpmRC | rpmInstallSourcePackage (rpmts ts, FD_t fd, const char **specFilePtr, const char **cookie) |
Install source package. | |
const char *const | tag2sln (int tag) |
Return scriptlet name from tag. | |
void | handler (int signum) |
int | enableSignal (int signum) |
Enable a signal handler. | |
int | disableSignal (int signum) |
Disable a signal handler. | |
pid_t | psmRegisterFork (rpmpsm psm) |
Register a child reaper, then fork a child. | |
int | psmWaitUnregister (rpmpsm psm, pid_t child) |
Unregister a child reaper. | |
pid_t | psmWait (rpmpsm psm) |
Wait for child process to be reaped. | |
rpmRC | runScript (rpmpsm psm, Header h, const char *sln, int progArgc, const char **progArgv, const char *script, int arg1, int arg2) |
Run scriptlet with args. | |
rpmRC | runInstScript (rpmpsm psm) |
Retrieve and run scriptlet from header. | |
rpmRC | handleOneTrigger (const rpmpsm psm, Header sourceH, Header triggeredH, int arg2, unsigned char *triggersAlreadyRun) |
Execute triggers. | |
rpmRC | runTriggers (rpmpsm psm) |
Run trigger scripts in the database that are fired by this header. | |
rpmRC | runImmedTriggers (rpmpsm psm) |
Run triggers from this header that are fired by headers in the database. | |
const char *const | pkgStageString (pkgStage a) |
rpmpsm | XrpmpsmUnlink (rpmpsm psm, const char *msg, const char *fn, unsigned ln) |
rpmpsm | XrpmpsmLink (rpmpsm psm, const char *msg, const char *fn, unsigned ln) |
rpmpsm | rpmpsmFree (rpmpsm psm) |
Destroy a package state machine. | |
rpmpsm | rpmpsmNew (rpmts ts, rpmte te, rpmfi fi) |
Create and load a package state machine. | |
rpmRC | rpmpsmStage (rpmpsm psm, pkgStage stage) |
Package state machine driver. | |
Variables | |
int | _psm_debug = 0 |
tagMacro | tagMacros [] |
Macros to be defined from per-header tag values. | |
char * | SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin" |
sigset_t | caught |
psmtbl_s | psmtbl |
sigtbl_s | satbl [] |
int | ldconfig_done = 0 |
const char * | ldconfig_path = "/sbin/ldconfig" |
Definition in file psm.c.
|
|
|
|
|
|
|
|
|
Disable a signal handler.
Definition at line 578 of file psm.c. References sigtbl_s::active, psmtbl_s::nalloced, psmtbl_s::npsms, sigtbl_s::oact, psmtbl_s::psms, psmtbl, satbl, and sigtbl_s::signum. Referenced by psmWaitUnregister(). |
|
Enable a signal handler.
Definition at line 547 of file psm.c. References sigtbl_s::active, caught, sigtbl_s::handler, psmtbl_s::nalloced, psmtbl_s::npsms, sigtbl_s::oact, psmtbl_s::psms, psmtbl, satbl, and sigtbl_s::signum. Referenced by psmRegisterFork(). |
|
Execute triggers.
Definition at line 1092 of file psm.c. References rpmpsm_s::countCorrection, rpmpsm_s::fi, headerNVR(), HFD_t, HGE_t, int_32, rpmdbCountPackages(), rpmds, rpmdsAnyMatchesDep(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsN(), rpmdsNew(), rpmdsNext(), rpmdsSetNoPromote(), rpmfi, rpmRC, RPMRC_FAIL, RPMRC_OK, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, rpmTagType, rpmts, rpmtsGetRdb(), runScript(), rpmpsm_s::sense, and rpmpsm_s::ts. Referenced by runImmedTriggers(), and runTriggers(). |
|
Definition at line 497 of file psm.c. References sigtbl_s::active, caught, rpmpsm_s::child, psmtbl_s::nalloced, psmtbl_s::npsms, psmtbl_s::psms, psmtbl, rpmpsm_s::reaped, satbl, sigtbl_s::signum, and rpmpsm_s::status. |
|
Mark files in database shared with this package as "replaced".
Definition at line 157 of file psm.c. References alloca(), rpmpsm_s::fi, HGE_t, rpmdbAppendIterator(), rpmdbFreeIterator(), rpmdbGetIteratorOffset(), RPMDBI_PACKAGES, rpmdbNextIterator(), rpmdbSetIteratorModified(), rpmdbSetIteratorRewrite(), rpmfi, rpmfiFC(), RPMFILE_STATE_REPLACED, rpmRC, RPMRC_OK, RPMTAG_FILESTATES, rpmts, rpmtsInitIterator(), and rpmpsm_s::ts. Referenced by rpmpsmStage(). |
|
Definition at line 1287 of file psm.c. References pkgStage, PSM_CHROOT_IN, PSM_CHROOT_OUT, PSM_COMMIT, PSM_CREATE, PSM_DESTROY, PSM_FINI, PSM_IMMED_TRIGGERS, PSM_INIT, PSM_NOTIFY, PSM_PKGCOMMIT, PSM_PKGERASE, PSM_PKGINSTALL, PSM_PKGSAVE, PSM_POST, PSM_PRE, PSM_PROCESS, PSM_RPMDB_ADD, PSM_RPMDB_LOAD, PSM_RPMDB_REMOVE, PSM_RPMIO_FLAGS, PSM_SCRIPT, PSM_TRIGGERS, PSM_UNDO, and PSM_UNKNOWN. Referenced by rpmpsmStage(). |
|
Register a child reaper, then fork a child.
Definition at line 608 of file psm.c. References rpmpsm_s::child, enableSignal(), psmtbl_s::nalloced, psmtbl_s::npsms, psmtbl_s::psms, psmtbl, rpmpsm_s::reaped, rpmpsmLink, and xrealloc(). Referenced by runScript(). |
|
Wait for child process to be reaped.
Definition at line 717 of file psm.c. References _, rpmpsm_s::child, psmWaitUnregister(), rpmpsm_s::reaped, rpmpsm_s::reaper, RPMMESS_DEBUG, rpmMessage, rpmpsm_s::status, and rpmpsm_s::stepName. Referenced by runScript(). |
|
Unregister a child reaper.
Definition at line 662 of file psm.c. References _free(), rpmpsm_s::child, disableSignal(), psmtbl_s::nalloced, psmtbl_s::npsms, psmtbl_s::psms, psmtbl, rpmpsm_s::reaped, and rpmpsmFree(). Referenced by psmWait(). |
|
Define per-header macros.
Definition at line 109 of file psm.c. References addMacro(), argv, HGE_t, int_32, tagMacro::macroname, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmfi, rpmTagType, tagMacro::tag, and tagMacros. Referenced by rpmInstallSourcePackage(). |
|
Install source package.
Definition at line 232 of file psm.c. References _, _free(), CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_PATH, CPIO_MAP_UID, FA_CREATE, Fclose(), fdLink, headerFree(), headerIsEntry(), headerLink(), HFD_t, HGE_t, PSM_FINI, PSM_PKGINSTALL, PSM_PROCESS, RPMERR_NOSPEC, RPMERR_NOTSRPM, rpmError, rpmfi, rpmfiBuildFNames(), rpmfiFree(), RPMFILE_SPECFILE, rpmfiLink, rpmfiNew(), rpmGenPath(), rpmInstallLoadMacros(), rpmMkdirPath(), rpmpsmStage(), rpmRC, RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), RPMTAG_BASENAMES, RPMTAG_COOKIE, RPMTAG_SOURCEPACKAGE, rpmts, rpmtsAddInstallElement(), rpmtsClean(), rpmtsElement(), rpmtsFree(), rpmtsLink, rpmtsRootDir(), stpcpy(), xcalloc(), xmalloc(), and xstrdup(). Referenced by rpmInstall(). |
|
Destroy a package state machine.
Definition at line 1351 of file psm.c. References _free(), rpmpsm_s::fi, rpmpsm_s::nrefs, rpmfiFree(), rpmpsmUnlink, rpmteFree(), rpmtsFree(), rpmpsm_s::te, and rpmpsm_s::ts. Referenced by psmWaitUnregister(), rpmtsRun(), and rpmVerifyScript(). |
|
Create and load a package state machine.
Definition at line 1382 of file psm.c. References rpmpsm_s::fi, rpmfi, rpmfiLink, rpmpsmLink, rpmte, rpmts, rpmtsLink, rpmpsm_s::te, rpmpsm_s::ts, and xcalloc(). Referenced by rpmtsRun(), and rpmVerifyScript(). |
|
|
Compare headers to determine which header is "newer".
Definition at line 50 of file psm.c. References headerGetEntry(), int_32, RPMTAG_EPOCH, RPMTAG_RELEASE, RPMTAG_VERSION, and rpmvercmp(). Referenced by hdr_compare(), rpmInstall(), and rpmtsAddInstallElement(). |
|
Run triggers from this header that are fired by headers in the database.
Definition at line 1233 of file psm.c. References alloca(), rpmpsm_s::fi, handleOneTrigger(), HFD_t, HGE_t, int_32, rpmdbFreeIterator(), rpmdbNextIterator(), rpmfi, rpmRC, RPMRC_OK, RPMTAG_NAME, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, rpmTagType, rpmts, rpmtsInitIterator(), and rpmpsm_s::ts. Referenced by rpmpsmStage(). |
|
Retrieve and run scriptlet from header.
Definition at line 1039 of file psm.c. References alloca(), argv, rpmpsm_s::fi, HFD_t, HGE_t, rpmpsm_s::progTag, RPM_STRING_TYPE, rpmfi, rpmRC, RPMRC_OK, rpmTagType, runScript(), rpmpsm_s::scriptArg, rpmpsm_s::scriptTag, and tag2sln(). Referenced by rpmpsmStage(). |
|
Run scriptlet with args. Run a script with an interpreter. If the interpreter is not specified, /bin/sh will be used. If the interpreter is /bin/sh, then the args from the header will be ignored, passing instead arg1 and arg2.
Definition at line 762 of file psm.c. References _, _free(), alloca(), argv, rpmpsm_s::child, doputenv(), errno, Fclose(), fdDup(), Ferror(), rpmpsm_s::fi, Fileno(), Fopen(), Fwrite(), headerNVR(), HFD_t, HGE_t, ldconfig_done, ldconfig_path, makeTempFile(), psmRegisterFork(), psmWait(), rpmpsm_s::reaped, rpmpsm_s::reaper, RPMERR_SCRIPT, rpmError, rpmExpand(), rpmfi, rpmIsDebug, rpmIsVerbose, RPMMESS_DEBUG, rpmMessage, rpmRC, RPMRC_FAIL, RPMRC_OK, RPMTAG_INSTALLPREFIX, RPMTAG_INSTPREFIXES, rpmTagType, rpmts, rpmtsChrootDone(), rpmtsRootDir(), rpmtsScriptFd(), SCRIPT_PATH, rpmpsm_s::scriptTag, rpmpsm_s::status, rpmpsm_s::stepName, tag2sln(), rpmpsm_s::ts, rpmpsm_s::unorderedSuccessor, unsetenv(), URL_IS_PATH, URL_IS_UNKNOWN, and urlIsURL(). Referenced by handleOneTrigger(), and runInstScript(). |
|
Run trigger scripts in the database that are fired by this header.
Definition at line 1192 of file psm.c. References rpmpsm_s::countCorrection, rpmpsm_s::fi, handleOneTrigger(), rpmdbCountPackages(), rpmdbFreeIterator(), rpmdbNextIterator(), rpmfi, rpmRC, RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_TRIGGERNAME, rpmteN(), rpmts, rpmtsGetRdb(), rpmtsInitIterator(), rpmpsm_s::te, and rpmpsm_s::ts. Referenced by rpmpsmStage(). |
|
Return scriptlet name from tag.
Definition at line 446 of file psm.c. References RPMTAG_POSTIN, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PREUN, and RPMTAG_VERIFYSCRIPT. Referenced by rpmpsmStage(), runInstScript(), and runScript(). |
|
Definition at line 1338 of file psm.c. References _psm_debug, and rpmpsm_s::nrefs. |
|
Definition at line 1327 of file psm.c. References _psm_debug, and rpmpsm_s::nrefs. |
|
Definition at line 41 of file psm.c. Referenced by XrpmpsmLink(), and XrpmpsmUnlink(). |
|
Definition at line 462 of file psm.c. Referenced by enableSignal(), and handler(). |
|
Definition at line 739 of file psm.c. Referenced by runScript(). |
|
Definition at line 742 of file psm.c. Referenced by runScript(). |
|
Referenced by disableSignal(), enableSignal(), handler(), psmRegisterFork(), and psmWaitUnregister(). |
|
Referenced by disableSignal(), enableSignal(), and handler(). |
|
Definition at line 439 of file psm.c. Referenced by runScript(). |
|
Macros to be defined from per-header tag values.
Referenced by rpmInstallLoadMacros(). |