Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,22 @@ if(AKLITE_TAGS)
endif(AKLITE_TAGS)

option(DOCKER_APPS "Set to ON to compile with support for configuring docker-apps" OFF)
option(DOCKER_COMPOSE_APP "Set to ON to compile with support for configuring compose-apps" OFF)

if(DOCKER_APPS AND DOCKER_COMPOSE_APP)
message(FATAL_ERROR "DOCKER_APPS and DOCKER_COMPOSE_APP cannot be ON for a single build")
endif(DOCKER_APPS AND DOCKER_COMPOSE_APP)

if(DOCKER_APPS)
add_definitions(-DDOCKER_APPS)
message(STATUS "Enabling docker-apps support")
endif(DOCKER_APPS)

if(DOCKER_COMPOSE_APP)
add_definitions(-DDOCKER_COMPOSE_APP)
message(STATUS "Enabling compose-apps support")
endif(DOCKER_COMPOSE_APP)

IF (NOT DEFINED HARDWARE_ID)
message(FATAL_ERROR "Missing required value: HARDWARE_ID")
ENDIF()
Expand Down
22 changes: 15 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ struct Options {
#ifdef AKLITE_TAGS
string pacman_tags;
#endif
#ifdef DOCKER_APPS
string docker_apps;
#if defined DOCKER_APPS || defined DOCKER_COMPOSE_APP
string apps;
#endif
};

Expand Down Expand Up @@ -91,9 +91,9 @@ static bool _get_options(int argc, char **argv, Options &options)
"Configure aktualizr-lite to only apply updates from Targets with these tags.")
#endif
#endif
#ifdef DOCKER_APPS
("docker-apps,a", po::value<string>(&options.docker_apps),
"Configure package-manage for this comma separate list of docker-apps.")
#if defined DOCKER_APPS || defined DOCKER_COMPOSE_APP
("apps,a", po::value<string>(&options.apps),
"Configure package-manage for this comma separate list of apps.")
#endif
("hwid,i", po::value<string>(&options.hwid)->default_value(HARDWARE_ID),
"An identifier for the device's hardware type. Default is " HARDWARE_ID)
Expand Down Expand Up @@ -541,8 +541,16 @@ int main(int argc, char **argv)
string apps_root = options.sota_config_dir + "/docker-apps";
device.put("overrides.pacman.type", "\"ostree+docker-app\"");
device.put("overrides.pacman.docker_apps_root", "\"" + apps_root + "\"");
if (!options.docker_apps.empty()) {
device.put("overrides.pacman.docker_apps", "\"" + options.docker_apps + "\"");
if (!options.apps.empty()) {
device.put("overrides.pacman.docker_apps", "\"" + options.apps + "\"");
}
#endif
#ifdef DOCKER_COMPOSE_APP
string apps_root = options.sota_config_dir + "/compose-apps";
device.put("overrides.pacman.type", "\"ostree+compose_apps\"");
device.put("overrides.pacman.compose_apps_root", "\"" + apps_root + "\"");
if (!options.apps.empty()) {
device.put("overrides.pacman.compose_apps", "\"" + options.apps + "\"");
}
#endif
stringstream data;
Expand Down