Fixups to initial Config
This commit is contained in:
+22
-9
@@ -771,7 +771,8 @@ void DeployVarConfig()
|
||||
void InstallPgpKey()
|
||||
{
|
||||
fs::path homeDir = "/var/pipedal/config/gpg";
|
||||
fs::path keyPath = "/etc/pipedal/config/updatekey.gpg";
|
||||
fs::path keyPath = "/etc/pipedal/config/updatekey.asc";
|
||||
fs::path keyPath2 = "/etc/pipedal/config/updatekey2.asc";
|
||||
|
||||
fs::create_directories(homeDir);
|
||||
std::ignore = chmod(homeDir.c_str(), 0700);
|
||||
@@ -781,15 +782,26 @@ void InstallPgpKey()
|
||||
s << (CHOWN_BIN " " SERVICE_GROUP_NAME ":" SERVICE_GROUP_NAME " ") << homeDir.c_str();
|
||||
sysExec(s.str().c_str());
|
||||
}
|
||||
std::ostringstream ss;
|
||||
ss << "/usr/bin/gpg --homedir " << homeDir.c_str() << " --import " << keyPath.c_str();
|
||||
|
||||
int rc = silentSysExec(ss.str().c_str());
|
||||
if (rc != EXIT_SUCCESS)
|
||||
{
|
||||
cout << "Error: Failed to create update keyring." << endl;
|
||||
}
|
||||
std::ostringstream ss;
|
||||
ss << "/usr/bin/gpg --homedir " << homeDir.c_str() << " --import " << keyPath.c_str();
|
||||
int rc = silentSysExec(ss.str().c_str());
|
||||
if (rc != EXIT_SUCCESS)
|
||||
{
|
||||
cout << "Error: Failed to create update keyring." << endl;
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << "/usr/bin/gpg --homedir " << homeDir.c_str() << " --import " << keyPath2.c_str();
|
||||
int rc = silentSysExec(ss.str().c_str());
|
||||
if (rc != EXIT_SUCCESS)
|
||||
{
|
||||
cout << "Error: Failed to add update key." << endl;
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << (CHOWN_BIN " -R " SERVICE_GROUP_NAME ":" SERVICE_GROUP_NAME " ") << homeDir.c_str();
|
||||
@@ -1396,10 +1408,11 @@ int main(int argc, char **argv)
|
||||
else if (disable_p2p)
|
||||
{
|
||||
WifiDirectConfigSettings settings;
|
||||
settings.valid_ = true;
|
||||
settings.Load();
|
||||
settings.enable_ = false;
|
||||
SetWifiDirectConfig(settings);
|
||||
RestartService(true);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else if (enable_ap)
|
||||
{
|
||||
|
||||
@@ -559,6 +559,13 @@ void UninstallP2p()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (UsingNetworkManager())
|
||||
{
|
||||
// dhcpcd comes up enabled after an install, so stop it always.
|
||||
sysExec(SYSTEMCTL_BIN " stop dhcpcd");
|
||||
sysExec(SYSTEMCTL_BIN " disable dhcpcd");
|
||||
|
||||
}
|
||||
::sync();
|
||||
}
|
||||
|
||||
+3
-6
@@ -847,14 +847,13 @@ void Updater::ValidateSignature(const std::filesystem::path &file, const std::fi
|
||||
}
|
||||
std::string keyId = getFingerprint(gpgText);
|
||||
|
||||
Lv2Log::info(unCRLF(gpgText)); // yyy delete me.
|
||||
|
||||
if (keyId != UPDATE_GPG_FINGERPRINT)
|
||||
if (keyId != UPDATE_GPG_FINGERPRINT && keyId != UPDATE_GPG_FINGERPRINT2)
|
||||
{
|
||||
throw std::runtime_error(SS("Update signature has the wrong fingerprint: " << keyId));
|
||||
throw std::runtime_error(SS("Update signature has the wrong id: " << keyId));
|
||||
}
|
||||
std::string origin = getAddress(gpgText);
|
||||
if (origin != UPDATE_GPG_ADDRESS)
|
||||
if (origin != UPDATE_GPG_ADDRESS && origin != UPDATE_GPG_ADDRESS2)
|
||||
{
|
||||
throw std::runtime_error(SS("Update signature has an incorrect address." << origin));
|
||||
}
|
||||
@@ -934,7 +933,6 @@ void Updater::DownloadUpdate(const std::string &url, std::filesystem::path *file
|
||||
responseOption = "-w \"%%{response_code}\""; // windows shell requires doubling of the %%.
|
||||
#endif
|
||||
std::string args = SS("-s -L " << responseOption << " " << url << " -o " << downloadFilePath.c_str());
|
||||
Lv2Log::info(SS("/usr/bin/curl " << args)); // yyy delete me.
|
||||
auto curlOutput = sysExecForOutput("/usr/bin/curl", args);
|
||||
if (curlOutput.exitCode != EXIT_SUCCESS || badOutput(downloadFilePath))
|
||||
{
|
||||
@@ -944,7 +942,6 @@ void Updater::DownloadUpdate(const std::string &url, std::filesystem::path *file
|
||||
checkCurlHttpResponse(curlOutput.output);
|
||||
|
||||
args = SS("-s -L " << responseOption << " " << signatureUrl << " -o " << downloadSignaturePath.c_str());
|
||||
Lv2Log::info(SS("/usr/bin/curl " << args));
|
||||
|
||||
curlOutput = sysExecForOutput("/usr/bin/curl", args);
|
||||
if (curlOutput.exitCode != EXIT_SUCCESS || badOutput(downloadSignaturePath))
|
||||
|
||||
@@ -42,10 +42,17 @@
|
||||
#ifndef UPDATE_GPG_ADDRESS
|
||||
#define UPDATE_GPG_ADDRESS "Robin Davies <rerdavies@gmail.com>"
|
||||
#endif
|
||||
#ifndef UPDATE_GPG_ADDRESS2
|
||||
#define UPDATE_GPG_ADDRESS2 "PiPedal Project <rerdavies@gmail.com>"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef UPDATE_GPG_FINGERPRINT
|
||||
#define UPDATE_GPG_FINGERPRINT "381124E2BB4478D225D2313B2AEF3F7BD53EAA59"
|
||||
#endif
|
||||
#ifndef UPDATE_GPG_FINGERPRINT2
|
||||
#define UPDATE_GPG_FINGERPRINT2 "2D1F39DBB1F819412B678F88E9D7081E08E3D85C"
|
||||
#endif
|
||||
|
||||
// Configuration for downloading of updates.
|
||||
|
||||
|
||||
@@ -401,7 +401,6 @@ public:
|
||||
|
||||
if (patchProperty.length() == 0 && directory.length() == 0)
|
||||
{
|
||||
// yyy no throwing!
|
||||
throw PiPedalException("Malformed request.");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user