18 #ifndef LIBPKG_TRIGGERS 19 #define LIBPKG_TRIGGERS 43 bool _shared_vars_deleted;
49 trigger_info() : has_install_unwind(
false), has_remove_unwind(
false) {}
50 trigger_info(
const std::string &oldver,
const std::string &newver) :
51 old_version(oldver), new_version(newver),
52 has_install_unwind(
false), has_remove_unwind(
false)
56 std::string old_version;
58 std::string new_version;
60 bool has_install_unwind;
62 bool has_remove_unwind;
65 std::map<std::string, trigger_info> _packages;
67 std::set<std::string> _pre_install;
69 std::set<std::string> _post_install;
71 std::set<std::string> _pre_remove;
73 std::set<std::string> _post_remove;
75 std::set<std::string> _post_remove_files_to_copy;
77 std::set<std::string> _post_remove_files;
79 std::set<std::string> _pre_install_unwind;
81 std::set<std::string> _pre_remove_unwind;
99 void add_pre_install(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version,
bool has_unwind);
106 void add_post_install(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version);
113 void add_pre_remove(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version);
120 void add_post_remove(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version);
127 void add_post_install_abort(
const string &pkgname,
const std::string &old_version,
const std::string &new_version);
A class to manage the package triggers executed during the commiting of the packages.
Definition: triggers.h:38
trigger * next_pre_install_trigger()
Remove and return the next pre install trigger to run.
Definition: triggers.cc:160
bool pre_remove_triggers_to_run() const
Check if there are any pre remove triggers to run.
Definition: triggers.cc:140
bool copy_post_remove_file()
Copy one post remove trigger file for use later.
Definition: triggers.cc:119
bool post_remove_files_to_copy() const
Check if there are any post remove triggers left to copy.
Definition: triggers.cc:114
bool pre_remove_to_unwind() const
Check if there are any pre remove triggers to remove.
Definition: triggers.cc:213
void remove_post_remove_file()
Remove a post remove copied field.
Definition: triggers.cc:232
The namespace used to hold the package management library.
Definition: auto_dir.cc:23
~triggers()
Definition: triggers.cc:56
trigger * next_pre_remove_unwind()
Return a post install trigger to be called to unwind the action of a pre remove trigger.
Definition: triggers.cc:218
triggers(pkgbase &pb, trigger_run *tr, log *lg)
Construct the class to maintain lists and create triggers.
Definition: triggers.cc:48
void add_pre_remove(const std::string &pkgname, const std::string &old_version, const std::string &new_version)
Add pre remove trigger to list of triggers.
Definition: triggers.cc:81
A class for automatically creating and deleting directories.
Definition: auto_dir.h:31
bool post_install_triggers_to_run() const
Check if there are any post install triggers to run.
Definition: triggers.cc:185
class to represent a trigger action from a script
Definition: trigger.h:33
void add_post_install(const std::string &pkgname, const std::string &old_version, const std::string &new_version)
Add post install trigger to list of triggers.
Definition: triggers.cc:72
trigger * next_post_remove_trigger()
Remove and return the next post remove trigger to run.
Definition: triggers.cc:176
void add_pre_install(const std::string &pkgname, const std::string &old_version, const std::string &new_version, bool has_unwind)
Add pre install trigger to list of triggers.
Definition: triggers.cc:62
void add_post_remove_file(const std::string &filename)
Add file to list of files that need to be copied so they are available to run after the package has b...
Definition: triggers.cc:109
Class to log actions that occur in LibPkg.
Definition: log.h:226
void add_post_remove(const std::string &pkgname, const std::string &old_version, const std::string &new_version)
Add post remove trigger to list of triggers.
Definition: triggers.cc:90
trigger * next_pre_install_unwind()
Return a post remove trigger to be called to unwind the action of a pre install trigger.
Definition: triggers.cc:204
Interface to execute a trigger.
Definition: trigger.h:77
bool post_remove_files_to_remove() const
Check if there are any post remove trigger copies to remove.
Definition: triggers.cc:227
A class for representing the collection of package database tables.
Definition: pkgbase.h:35
bool post_remove_triggers_to_run() const
Check if there are any post remove triggers to run.
Definition: triggers.cc:171
bool pre_install_to_unwind() const
Check if there are any pre install triggers to unwind.
Definition: triggers.cc:199
void delete_shared_vars()
Delete the shared environmental variables created by the triggers.
Definition: triggers.cc:241
void add_post_install_abort(const string &pkgname, const std::string &old_version, const std::string &new_version)
Set package being removed has a post install trigger.
Definition: triggers.cc:99
bool pre_install_triggers_to_run() const
Check if there are any pre install triggers to run.
Definition: triggers.cc:155
trigger * next_post_install_trigger()
Remove and return the next postinstall trigger to run.
Definition: triggers.cc:190
trigger * next_pre_remove_trigger()
Remove and return the next pre remove trigger to run.
Definition: triggers.cc:145