Skip to content

Commit 2cc013f

Browse files
authored
Change dryRun variable to false, make mac_address field optional on application network answerfile section (#36)
* Application network is no longer mandatory on answerfile, change cloyster.h dryRun variable to false by default Signed-off-by: lbgracioso <[email protected]> * Add user confirmation to run the project Signed-off-by: lbgracioso <[email protected]> * Change to while loop on unattended confirmation Signed-off-by: lbgracioso <[email protected]> --------- Signed-off-by: lbgracioso <[email protected]>
1 parent a938139 commit 2cc013f

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

include/cloysterhpc/cloyster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace cloyster {
1515
bool showVersion = false;
1616
bool runAsRoot = false;
17-
bool dryRun = true;
17+
bool dryRun = false;
1818
bool enableTUI = false;
1919
bool enableCLI = false;
2020
bool runAsDaemon = false;

src/answerfile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void AnswerFile::loadApplicationNetwork()
165165
}
166166

167167
application.con_mac_addr
168-
= m_ini.getValue("network_application", "mac_address", false);
168+
= m_ini.getValue("network_application", "mac_address");
169169

170170
try {
171171
application.subnet_mask = convertStringToAddress(

src/cluster.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,10 @@ void Cluster::fillData(const std::string& answerfilePath)
577577
auto applicationConnection
578578
= Connection(&getNetwork(Network::Profile::Application));
579579

580-
applicationConnection.setMAC(
581-
answerfile.application.con_mac_addr.value());
580+
if (!answerfile.application.con_mac_addr->empty()) {
581+
applicationConnection.setMAC(
582+
answerfile.application.con_mac_addr.value());
583+
}
582584

583585
applicationConnection.setInterface(
584586
answerfile.application.con_interface.value());

src/main.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ int main(int argc, const char** argv)
7575
app.add_option(
7676
"-a, --answerfile", cloyster::answerfile, "Full path to a answerfile");
7777

78+
bool unattended = false;
79+
app.add_flag(
80+
"-u, --unattended", unattended, "Perform an unattended installation");
81+
7882
CLI11_PARSE(app, argc, argv)
7983

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

98102
try {
103+
while (!unattended) {
104+
char response = 'N';
105+
fmt::print("{} will now modify your system, do you want to "
106+
"continue? [Y/N]\n",
107+
cloyster::productName);
108+
std::cin >> response;
109+
110+
if (response == 'Y' || response == 'y') {
111+
LOG_INFO("Running {}.\n", cloyster::productName)
112+
break;
113+
} else if (response == 'N' || response == 'n') {
114+
LOG_INFO("Stopping {}.\n", cloyster::productName);
115+
return EXIT_SUCCESS;
116+
}
117+
}
118+
99119
if (cloyster::showVersion) {
100120
fmt::print("{}: Version {}\n", productName, productVersion);
101121
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)