rpmdep = malloc(sizeof(*rpmdep));
rpmdep->db = db;
+ rpmdep->scriptFd = NULL;
rpmdep->numRemovedPackages = 0;
rpmdep->allocedRemovedPackages = 5;
rpmdep->removedPackages = malloc(sizeof(int) *
int numRemovedPackages, allocedRemovedPackages;
struct availableList addedPackages, availablePackages;
char * root;
+ FD_t scriptFd;
};
struct problemsSet {
int flags, rpmCallbackFunction notify,
void * notifyData, const void * pkgKey,
enum fileActions * actions,
- struct sharedFileInfo * sharedList) {
+ struct sharedFileInfo * sharedList, FD_t scriptFd) {
int rc;
char * name, * version, * release;
int fileCount, type, count;
rpmMessage(RPMMESS_DEBUG, _("running preinstall script (if any)\n"));
if (runInstScript("/", h, RPMTAG_PREIN, RPMTAG_PREINPROG, scriptArg,
- flags & RPMINSTALL_NOSCRIPTS, 0)) {
+ flags & RPMINSTALL_NOSCRIPTS, scriptFd)) {
if (freeFileMem) freeFileMemory(fileMem);
if (rootdir) {
rpmMessage(RPMMESS_DEBUG, _("running postinstall script (if any)\n"));
if (runInstScript(rootdir, h, RPMTAG_POSTIN, RPMTAG_POSTINPROG, scriptArg,
- flags & RPMINSTALL_NOSCRIPTS, 0)) {
+ flags & RPMINSTALL_NOSCRIPTS, scriptFd)) {
return 2;
}
if (!(flags & RPMINSTALL_NOTRIGGERS)) {
/* Run triggers this package sets off */
- if (runTriggers(rootdir, db, RPMSENSE_TRIGGERIN, h, 0)) {
+ if (runTriggers(rootdir, db, RPMSENSE_TRIGGERIN, h, 0, scriptFd)) {
return 2;
}
/* Run triggers in this package which are set off by other things in
the database. */
- if (runImmedTriggers(rootdir, db, RPMSENSE_TRIGGERIN, h, 0)) {
+ if (runImmedTriggers(rootdir, db, RPMSENSE_TRIGGERIN, h, 0, scriptFd)) {
return 2;
}
}
enum fileTypes { XDIR, BDEV, CDEV, SOCK, PIPE, REG, LINK } ;
int removeBinaryPackage(char * root, rpmdb db, unsigned int offset, int flags,
- enum fileActions * actions);
+ enum fileActions * actions, FD_t scriptFd);
int runInstScript(const char * prefix, Header h, int scriptTag, int progTag,
int arg, int norunScripts, FD_t err);
/* this looks for triggers in the database which h would set off */
int runTriggers(const char * root, rpmdb db, int sense, Header h,
- int countCorrection);
+ int countCorrection, FD_t scriptFd);
/* while this looks for triggers in h which are set off by things in the db
database to calculate arguments to the trigger */
int runImmedTriggers(const char * root, rpmdb db, int sense, Header h,
- int countCorrection);
+ int countCorrection, FD_t scriptFd);
int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h,
int flags, rpmCallbackFunction notify,
void * notifyData, const void * pkgKey,
enum fileActions * actions,
- struct sharedFileInfo * sharedList);
+ struct sharedFileInfo * sharedList, FD_t scriptFd);
const char * fileActionString(enum fileActions a);
#endif /* H_INSTALL */
typedef enum rpmCallbackType_e
{ RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START,
- RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_CLOSE_FILE
+ RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_CLOSE_FILE,
} rpmCallbackType;
typedef void * (*rpmCallbackFunction)(const Header h,
const rpmCallbackType what,
void rpmtransAvailablePackage(rpmTransactionSet rpmdep, Header h, void * key);
void rpmtransRemovePackage(rpmTransactionSet rpmdep, int dboffset);
void rpmtransFree(/*@only@*/ rpmTransactionSet rpmdep);
+void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd);
/* this checks for dependency satisfaction, but *not* ordering */
int rpmdepCheck(rpmTransactionSet rpmdep,
const char * script, int arg1, int arg2, FD_t errfd);
int removeBinaryPackage(char * prefix, rpmdb db, unsigned int offset,
- int flags, enum fileActions * actions) {
+ int flags, enum fileActions * actions, FD_t scriptFd) {
Header h;
int i;
int fileCount;
if (!(flags & RPMUNINSTALL_NOTRIGGERS)) {
/* run triggers from this package which are keyed on installed
packages */
- if (runImmedTriggers(prefix, db, RPMSENSE_TRIGGERUN, h, -1)) {
+ if (runImmedTriggers(prefix, db, RPMSENSE_TRIGGERUN, h, -1, scriptFd)) {
return 2;
}
/* run triggers which are set off by the removal of this package */
- if (runTriggers(prefix, db, RPMSENSE_TRIGGERUN, h, -1))
+ if (runTriggers(prefix, db, RPMSENSE_TRIGGERUN, h, -1, scriptFd))
return 1;
}
if (!(flags & RPMUNINSTALL_TEST)) {
if (runInstScript(prefix, h, RPMTAG_PREUN, RPMTAG_PREUNPROG, scriptArg,
- flags & RPMUNINSTALL_NOSCRIPTS, 0)) {
+ flags & RPMUNINSTALL_NOSCRIPTS, scriptFd)) {
headerFree(h);
return 1;
}
if (!(flags & RPMUNINSTALL_TEST)) {
rpmMessage(RPMMESS_DEBUG, _("running postuninstall script (if any)\n"));
runInstScript(prefix, h, RPMTAG_POSTUN, RPMTAG_POSTUNPROG, scriptArg,
- flags & RPMUNINSTALL_NOSCRIPTS, 0);
+ flags & RPMUNINSTALL_NOSCRIPTS, scriptFd);
}
if (!(flags & RPMUNINSTALL_NOTRIGGERS)) {
/* Run postun triggers which are set off by this package's removal */
- if (runTriggers(prefix, db, RPMSENSE_TRIGGERPOSTUN, h, 0)) {
+ if (runTriggers(prefix, db, RPMSENSE_TRIGGERPOSTUN, h, 0, scriptFd)) {
return 2;
}
}
static int handleOneTrigger(const char * root, rpmdb db, int sense, Header sourceH,
Header triggeredH, int arg1correction, int arg2,
- char * triggersAlreadyRun) {
+ char * triggersAlreadyRun, FD_t scriptFd) {
const char ** triggerNames;
const char ** triggerVersions;
const char ** triggerScripts;
if (!triggersAlreadyRun || !triggersAlreadyRun[index]) {
rc = runScript(triggeredH, root, 1, triggerProgs + index,
triggerScripts[index],
- dbiIndexSetCount(matches) + arg1correction, arg2, 0);
+ dbiIndexSetCount(matches) + arg1correction, arg2,
+ scriptFd);
if (triggersAlreadyRun) triggersAlreadyRun[index] = 1;
}
}
int runTriggers(const char * root, rpmdb db, int sense, Header h,
- int countCorrection) {
+ int countCorrection, FD_t scriptFd) {
char * packageName;
dbiIndexSet matches, otherMatches;
Header triggeredH;
return 1;
rc |= handleOneTrigger(root, db, sense, h, triggeredH, 0, numPackage,
- NULL);
+ NULL, scriptFd);
headerFree(triggeredH);
}
}
int runImmedTriggers(const char * root, rpmdb db, int sense, Header h,
- int countCorrection) {
+ int countCorrection, FD_t scriptFd) {
int rc = 0;
dbiIndexSet matches;
char ** triggerNames;
if ((sourceH = rpmdbGetRecord(db, recOffset)) == NULL)
return 1;
rc |= handleOneTrigger(root, db, sense, sourceH, h,
- countCorrection, dbiIndexSetCount(matches), triggersRun);
+ countCorrection, dbiIndexSetCount(matches),
+ triggersRun, scriptFd);
headerFree(sourceH);
if (triggersRun[triggerIndices[i]]) break;
}