7 #ifndef LIBPKG_TRIGGERS 8 #define LIBPKG_TRIGGERS 32 bool _shared_vars_deleted;
38 trigger_info() : has_install_unwind(
false), has_remove_unwind(
false) {}
39 trigger_info(
const std::string &oldver,
const std::string &newver) :
40 old_version(oldver), new_version(newver),
41 has_install_unwind(
false), has_remove_unwind(
false)
45 std::string old_version;
47 std::string new_version;
49 bool has_install_unwind;
51 bool has_remove_unwind;
54 std::map<std::string, trigger_info> _packages;
56 std::set<std::string> _pre_install;
58 std::set<std::string> _post_install;
60 std::set<std::string> _pre_remove;
62 std::set<std::string> _post_remove;
64 std::set<std::string> _post_remove_files_to_copy;
66 std::set<std::string> _post_remove_files;
68 std::set<std::string> _pre_install_unwind;
70 std::set<std::string> _pre_remove_unwind;
88 void add_pre_install(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version,
bool has_unwind);
95 void add_post_install(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version);
102 void add_pre_remove(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version);
109 void add_post_remove(
const std::string &pkgname,
const std::string &old_version,
const std::string &new_version);
116 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:27
trigger * next_pre_install_trigger()
Remove and return the next pre install trigger to run.
Definition: triggers.cc:150
bool pre_remove_triggers_to_run() const
Check if there are any pre remove triggers to run.
Definition: triggers.cc:130
bool copy_post_remove_file()
Copy one post remove trigger file for use later.
Definition: triggers.cc:109
bool post_remove_files_to_copy() const
Check if there are any post remove triggers left to copy.
Definition: triggers.cc:104
bool pre_remove_to_unwind() const
Check if there are any pre remove triggers to remove.
Definition: triggers.cc:203
void remove_post_remove_file()
Remove a post remove copied field.
Definition: triggers.cc:222
The namespace used to hold the package management library.
Definition: auto_dir.cc:12
~triggers()
Definition: triggers.cc:46
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:208
triggers(pkgbase &pb, trigger_run *tr, log *lg)
Construct the class to maintain lists and create triggers.
Definition: triggers.cc:38
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:71
A class for automatically creating and deleting directories.
Definition: auto_dir.h:20
bool post_install_triggers_to_run() const
Check if there are any post install triggers to run.
Definition: triggers.cc:175
class to represent a trigger action from a script
Definition: trigger.h:22
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:62
trigger * next_post_remove_trigger()
Remove and return the next post remove trigger to run.
Definition: triggers.cc:166
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:52
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:99
Class to log actions that occur in LibPkg.
Definition: log.h:215
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:80
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:194
Interface to execute a trigger.
Definition: trigger.h:66
bool post_remove_files_to_remove() const
Check if there are any post remove trigger copies to remove.
Definition: triggers.cc:217
A class for representing the collection of package database tables.
Definition: pkgbase.h:24
bool post_remove_triggers_to_run() const
Check if there are any post remove triggers to run.
Definition: triggers.cc:161
bool pre_install_to_unwind() const
Check if there are any pre install triggers to unwind.
Definition: triggers.cc:189
void delete_shared_vars()
Delete the shared environmental variables created by the triggers.
Definition: triggers.cc:231
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:89
bool pre_install_triggers_to_run() const
Check if there are any pre install triggers to run.
Definition: triggers.cc:145
trigger * next_post_install_trigger()
Remove and return the next postinstall trigger to run.
Definition: triggers.cc:180
trigger * next_pre_remove_trigger()
Remove and return the next pre remove trigger to run.
Definition: triggers.cc:135