Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dryRun variable to false, make mac_address field optional on application network answerfile section #36

Merged
merged 3 commits into from
Feb 22, 2024
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
2 changes: 1 addition & 1 deletion include/cloysterhpc/cloyster.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace cloyster {
bool showVersion = false;
bool runAsRoot = false;
bool dryRun = true;
bool dryRun = false;
bool enableTUI = false;
bool enableCLI = false;
bool runAsDaemon = false;
Expand Down
2 changes: 1 addition & 1 deletion src/answerfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void AnswerFile::loadApplicationNetwork()
}

application.con_mac_addr
= m_ini.getValue("network_application", "mac_address", false);
= m_ini.getValue("network_application", "mac_address");

try {
application.subnet_mask = convertStringToAddress(
Expand Down
6 changes: 4 additions & 2 deletions src/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,10 @@ void Cluster::fillData(const std::string& answerfilePath)
auto applicationConnection
= Connection(&getNetwork(Network::Profile::Application));

applicationConnection.setMAC(
answerfile.application.con_mac_addr.value());
if (!answerfile.application.con_mac_addr->empty()) {
applicationConnection.setMAC(
answerfile.application.con_mac_addr.value());
}

applicationConnection.setInterface(
answerfile.application.con_interface.value());
Expand Down
20 changes: 20 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ int main(int argc, const char** argv)
app.add_option(
"-a, --answerfile", cloyster::answerfile, "Full path to a answerfile");

bool unattended = false;
app.add_flag(
"-u, --unattended", unattended, "Perform an unattended installation");

CLI11_PARSE(app, argc, argv)

Log::init([]() {
Expand All @@ -96,6 +100,22 @@ int main(int argc, const char** argv)
LOG_INFO("{} Started", productName);

try {
while (!unattended) {
char response = 'N';
fmt::print("{} will now modify your system, do you want to "
"continue? [Y/N]\n",
cloyster::productName);
std::cin >> response;

if (response == 'Y' || response == 'y') {
LOG_INFO("Running {}.\n", cloyster::productName)
break;
} else if (response == 'N' || response == 'n') {
LOG_INFO("Stopping {}.\n", cloyster::productName);
return EXIT_SUCCESS;
}
}

if (cloyster::showVersion) {
fmt::print("{}: Version {}\n", productName, productVersion);
return EXIT_SUCCESS;
Expand Down
Loading