summaryrefslogtreecommitdiff
path: root/hscript/script_i.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-24 20:35:14 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-24 20:35:14 -0500
commit9c9e400b68f9cfb2270434fb8a16cc0df906ab8b (patch)
tree051470d7c3d29401462e3563bca34b11e58af5c5 /hscript/script_i.hh
parentb9980223dd469f24359d969ab24c3694507897e5 (diff)
downloadhorizon-9c9e400b68f9cfb2270434fb8a16cc0df906ab8b.tar.gz
horizon-9c9e400b68f9cfb2270434fb8a16cc0df906ab8b.tar.bz2
horizon-9c9e400b68f9cfb2270434fb8a16cc0df906ab8b.tar.xz
horizon-9c9e400b68f9cfb2270434fb8a16cc0df906ab8b.zip
hscript: Implement 'svcenable' key and tests
Diffstat (limited to 'hscript/script_i.hh')
-rw-r--r--hscript/script_i.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/hscript/script_i.hh b/hscript/script_i.hh
index a94a0d7..b91e60f 100644
--- a/hscript/script_i.hh
+++ b/hscript/script_i.hh
@@ -72,6 +72,9 @@ struct Script::ScriptPrivate {
/*! APK repository keys */
std::vector< std::unique_ptr<SigningKey> > repo_keys;
+ /*! Services to enable */
+ std::vector< std::unique_ptr<SvcEnable> > svcs_enable;
+
/*! User account information */
std::map< std::string, std::unique_ptr<UserDetail> > accounts;
@@ -232,6 +235,22 @@ struct Script::ScriptPrivate {
return true;
}
+ bool store_svcenable(Key *obj, int line, int *, int *warn, ScriptOptions) {
+ std::unique_ptr<SvcEnable> svc(dynamic_cast<SvcEnable *>(obj));
+ for(const auto &s : svcs_enable) {
+ if(s->value() == svc->value()) {
+ if(warn) *warn += 1;
+ output_warning("installfile:" + std::to_string(line),
+ "svcenable: service already enabled",
+ s->value());
+ return true;
+ }
+ }
+
+ svcs_enable.push_back(std::move(svc));
+ return true;
+ }
+
bool store_username(Key *obj, int line, int *errors, int *, ScriptOptions) {
if(accounts.size() >= 255) {
if(errors) *errors += 1;