1 #include "debianmanager.h" 2 #include "packagemanagerfactory.h" 7 AUTO_REGISTER_PACKAGE_MANAGER(PACKAGE_MANAGER_DEBIAN,
DebianManager);
9 Json::Value DebianManager::getInstalledPackages()
const {
11 return Json::Value(Json::arrayValue);
15 std::lock_guard<std::mutex> guard(mutex_);
16 LOG_INFO <<
"Installing " << target.filename() <<
" as Debian package...";
17 std::string cmd =
"dpkg -i ";
20 auto target_file = storage_->openTargetFile(target);
22 boost::filesystem::path deb_path = package_dir / target.filename();
23 target_file->writeToFile(deb_path);
24 target_file->rclose();
26 int status = Utils::shell(cmd + deb_path.string(), &output,
true);
28 LOG_INFO <<
"... Installation of Debian package successful";
29 storage_->savePrimaryInstalledVersion(target, InstalledVersionUpdateMode::kCurrent);
32 LOG_ERROR <<
"... Installation of Debian package failed";
37 boost::optional<Uptane::Target> current_version;
38 storage_->loadPrimaryInstalledVersions(¤t_version,
nullptr);
40 if (!!current_version) {
41 return *current_version;
44 return Uptane::Target::Unknown();
Package installation failed.