summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-03-26 13:54:56 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-03-26 13:54:56 -0500
commitd0f56d00582903dbc758f25c48c743d29852a8d3 (patch)
tree30a3349a29aef2ec6e56e149d35c7671abe02ab2
parentaf4440337fa03df944afce3a6e0de8f277d15216 (diff)
downloadhorizon-d0f56d00582903dbc758f25c48c743d29852a8d3.tar.gz
horizon-d0f56d00582903dbc758f25c48c743d29852a8d3.tar.bz2
horizon-d0f56d00582903dbc758f25c48c743d29852a8d3.tar.xz
horizon-d0f56d00582903dbc758f25c48c743d29852a8d3.zip
Script: Use --keys-dir during base installation
If the system APK does not trust the keys specified in the HorizonScript, execution of the script would fail. This commit fixes that omission.
-rw-r--r--hscript/script_e.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/hscript/script_e.cc b/hscript/script_e.cc
index 91ebe0f..9e30b95 100644
--- a/hscript/script_e.cc
+++ b/hscript/script_e.cc
@@ -522,13 +522,15 @@ bool Script::execute() const {
/* REQ: Runner.Execute.pkginstall.APKDB */
output_info("internal", "initialising APK");
if(opts.test(Simulate)) {
- std::cout << "/sbin/apk --root " << targetDirectory() << " --initdb add"
+ std::cout << "/sbin/apk --root " << targetDirectory() << " --initdb "
+ << "--keys-dir " << targetDirectory() << "/etc/apk/keys add"
<< std::endl;
}
#ifdef HAS_INSTALL_ENV
else {
if(run_command("/sbin/apk",
- {"--root", targetDirectory(), "--initdb", "add"}) != 0) {
+ {"--root", targetDirectory(), "--initdb", "--keys-dir",
+ targetDirectory() + "/etc/apk/keys", "add"}) != 0) {
EXECUTE_FAILURE("pkginstall");
return false;
}
@@ -543,26 +545,31 @@ bool Script::execute() const {
pkg_list << pkg << " ";
}
- std::cout << "apk --root " << targetDirectory() << " update"
+ std::cout << "apk --root " << targetDirectory() << " --keys-dir "
+ << targetDirectory() << "/etc/apk/keys" << " update"
<< std::endl;
- std::cout << "apk --root " << targetDirectory() << " add "
+ std::cout << "apk --root " << targetDirectory() << " --keys-dir "
+ << targetDirectory() << "/etc/apk/keys" << " add "
<< pkg_list.str() << std::endl;
}
#ifdef HAS_INSTALL_ENV
else {
if(run_command("/sbin/apk",
- {"--root", targetDirectory(), "update"}) != 0) {
+ {"--root", targetDirectory(), "--keys-dir",
+ targetDirectory() + "/etc/apk/keys", "update"}) != 0) {
EXECUTE_FAILURE("pkginstall");
return false;
}
- std::vector<std::string> params(this->internal->packages.size() + 3);
+ std::vector<std::string> params(this->internal->packages.size() + 5);
params[0] = "--root";
params[1] = targetDirectory();
- params[2] = "add";
+ params[2] = "--keys-dir";
+ params[3] = targetDirectory() + "/etc/apk/keys";
+ params[4] = "add";
std::copy(this->internal->packages.begin(),
this->internal->packages.end(),
- params.begin() + 3);
+ params.begin() + 5);
if(run_command("/sbin/apk", params) != 0) {
EXECUTE_FAILURE("pkginstall");