Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Revert stripping of executable in release mode (#1234)
Browse files Browse the repository at this point in the history
Revert stripping of executable in release mode
  • Loading branch information
lbonn authored and Zee314159 committed Jun 21, 2019
2 parents 6f99217 + 18cb136 commit 8785818
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ if(FAULT_INJECTION)
endif(FAULT_INJECTION)

# flags for different build types
list(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " -s")

set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
set(CMAKE_C_FLAGS_DEBUG "-Og -g")

Expand Down
3 changes: 2 additions & 1 deletion scripts/build_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export TEST_WITH_TESTSUITE=0

# build and copy aktualizr.deb and garage_deploy.deb to $TEST_INSTALL_DESTDIR
mkdir -p "$TEST_INSTALL_DESTDIR"
"$GITREPO_ROOT/scripts/test.sh"
# note: executables are stripped, following common conventions in .deb packages
LDFLAGS="-s" "$GITREPO_ROOT/scripts/test.sh"

# copy provisioning data and scripts
cp -rf "$GITREPO_ROOT/tests/test_data/prov_selfupdate" "$TEST_INSTALL_DESTDIR"
Expand Down
34 changes: 26 additions & 8 deletions src/aktualizr_repo/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,25 @@ int main(int argc, char **argv) {
}

if (vm.count("command") != 0 && vm.count("path") != 0) {
std::string expiration_time;
std::string expiration_time;
if (vm.count("expires") != 0) {
expiration_time = vm["expires"].as<std::string>();
}
std::string correlation_id;
if (vm.count("correlationid") != 0) {
correlation_id = vm["correlationid"].as<std::string>();
}
UptaneRepo repo(vm["path"].as<boost::filesystem::path>(), expiration_time, correlation_id);
std::string dname;
if(vm.count("dname") != 0){
dname = vm["dname"].as<std::string>();
}
std::string command = vm["command"].as<std::string>();
boost::filesystem::path repo_dir = vm["path"].as<boost::filesystem::path>();
UptaneRepo repo(repo_dir, expiration_time, correlation_id);
if (command == "generate") {
KeyType key_type = parseKeyType(vm);
repo.generateRepo(key_type);
std::cout << "Uptane metadata repos generated at " << repo_dir << std::endl;
} else if (command == "image") {
if (vm.count("targetname") == 0 && vm.count("filename") == 0) {
std::cerr << "image command requires --targetname or --filename\n";
Expand All @@ -97,14 +103,16 @@ int main(int argc, char **argv) {

Delegation delegation;
if (vm.count("dname") != 0) {
delegation = Delegation(vm["path"].as<boost::filesystem::path>(), vm["dname"].as<std::string>());
delegation = Delegation(repo_dir, dname);
if (!delegation.isMatched(targetname)) {
std::cerr << "Image path doesn't match delegation!\n";
exit(EXIT_FAILURE);
}
std::cout << "Added a target " << targetname << " to a delegated role " << dname << std::endl;
}
if (vm.count("filename") > 0) {
repo.addImage(vm["filename"].as<boost::filesystem::path>(), targetname, delegation);
std::cout << "Added a target " << targetname << " to the images metadata" << std::endl;
} else {
if ((vm.count("targetsha256") == 0 && vm.count("targetsha512") == 0) || vm.count("targetlength") == 0) {
std::cerr << "image command requires --targetsha256 or --targetsha512, and --targetlength when --filename "
Expand All @@ -130,36 +138,46 @@ int main(int argc, char **argv) {
custom["targetFormat"] = vm["targetformat"].as<std::string>();
}
repo.addCustomImage(targetname.string(), *hash, vm["targetlength"].as<uint64_t>(), delegation, custom);
std::cout << "Added a target " << targetname.string() << " to the custom image" << std::endl;
}
} else if (command == "addtarget") {
if (vm.count("targetname") == 0 || vm.count("hwid") == 0 || vm.count("serial") == 0) {
std::cerr << "addtarget command requires --targetname, --hwid, and --serial\n";
exit(EXIT_FAILURE);
}
repo.addTarget(vm["targetname"].as<std::string>(), vm["hwid"].as<std::string>(),
vm["serial"].as<std::string>());
std::string targetname = vm["targetname"].as<std::string>();
std::string hwid = vm["hwid"].as<std::string>();
std::string serial = vm["serial"].as<std::string>();
repo.addTarget(targetname, hwid, serial);
std::cout << "Added target " << targetname << " to director targets metadata for ECU with serial " << serial << " and hardware ID " << hwid << std::endl;
} else if (command == "adddelegation") {
if (vm.count("dname") == 0 || vm.count("dpattern") == 0) {
std::cerr << "adddelegation command requires --dname and --dpattern\n";
exit(EXIT_FAILURE);
}
std::string dparent = vm["dparent"].as<std::string>();
std::string dpattern = vm["dpattern"].as<std::string>();
KeyType key_type = parseKeyType(vm);
repo.addDelegation(Uptane::Role(vm["dname"].as<std::string>(), true),
repo.addDelegation(Uptane::Role(dname, true),
Uptane::Role(dparent, dparent != "targets"), vm["dpattern"].as<std::string>(),
vm["dterm"].as<bool>(), key_type);
std::cout << "Added a delegated role " << dname << " with dpattern " << dpattern << " to the images metadata" << std::endl;
} else if (command == "revokedelegation") {
if (vm.count("dname") == 0) {
std::cerr << "revokedelegation command requires --dname\n";
exit(EXIT_FAILURE);
}
repo.revokeDelegation(Uptane::Role(vm["dname"].as<std::string>(), true));
repo.revokeDelegation(Uptane::Role(dname, true));
std::cout << "Revoked the delegation " << dname << std::endl;
} else if (command == "signtargets") {
repo.signTargets();
std::cout << "Signed the staged director targets metadata" << std::endl;
} else if (command == "emptytargets") {
repo.emptyTargets();
std::cout << "Cleared the staged director targets metadata" << std::endl;
} else if (command == "oldtargets") {
repo.oldTargets();
std::cout << "Populated the director targets metadata with the currently signed metadata" << std::endl;
} else if (command == "sign") {
if (vm.count("repotype") == 0 || vm.count("keyname") == 0) {
std::cerr << "sign command requires --repotype and --keyname\n";
Expand All @@ -171,7 +189,7 @@ int main(int argc, char **argv) {
std::string text_to_sign(it, end);

Repo base_repo(Uptane::RepositoryType(vm["repotype"].as<std::string>()),
vm["path"].as<boost::filesystem::path>(), expiration_time, correlation_id);
repo_dir, expiration_time, correlation_id);

auto json_to_sign = Utils::parseJSON(text_to_sign);
if (json_to_sign == Json::nullValue) {
Expand Down

0 comments on commit 8785818

Please sign in to comment.