Skip to content

Commit

Permalink
Remove "sudo" from system command
Browse files Browse the repository at this point in the history
sudo does not appear to work as systemd services
  • Loading branch information
cookpate committed Nov 12, 2024
1 parent 744b21c commit 7d088f5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions ggdeploymentd/src/deployment_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,7 @@ static void handle_deployment(
GglByteVec link_command_vec
= GGL_BYTE_VEC(link_command_buf);
ret = ggl_byte_vec_append(
&link_command_vec, GGL_STR("sudo systemctl link ")
&link_command_vec, GGL_STR("systemctl link ")
);
ggl_byte_vec_chain_append(
&ret,
Expand Down Expand Up @@ -2348,7 +2348,7 @@ static void handle_deployment(
GglByteVec start_command_vec
= GGL_BYTE_VEC(start_command_buf);
ret = ggl_byte_vec_append(
&start_command_vec, GGL_STR("sudo systemctl start ")
&start_command_vec, GGL_STR("systemctl start ")
);
ggl_byte_vec_chain_append(
&ret,
Expand Down Expand Up @@ -2412,7 +2412,7 @@ static void handle_deployment(
GglByteVec link_command_vec
= GGL_BYTE_VEC(link_command_buf);
ret = ggl_byte_vec_append(
&link_command_vec, GGL_STR("sudo systemctl link ")
&link_command_vec, GGL_STR("systemctl link ")
);
ggl_byte_vec_chain_append(
&ret, &link_command_vec, service_file_path_vec.buf
Expand All @@ -2427,15 +2427,15 @@ static void handle_deployment(
int system_ret = system((char *) link_command_vec.buf.data);
if (WIFEXITED(system_ret)) {
if (WEXITSTATUS(system_ret) != 0) {
GGL_LOGE("sudo systemctl link command failed");
GGL_LOGE("systemctl link command failed");
return;
}
GGL_LOGI(
"sudo systemctl link exited with child status %d\n",
"systemctl link exited with child status %d\n",
WEXITSTATUS(system_ret)
);
} else {
GGL_LOGE("sudo systemctl link did not exit normally");
GGL_LOGE("systemctl link did not exit normally");
return;
}

Expand All @@ -2444,7 +2444,7 @@ static void handle_deployment(
GglByteVec enable_command_vec
= GGL_BYTE_VEC(enable_command_buf);
ret = ggl_byte_vec_append(
&enable_command_vec, GGL_STR("sudo systemctl enable ")
&enable_command_vec, GGL_STR("systemctl enable ")
);
ggl_byte_vec_chain_append(
&ret, &enable_command_vec, service_file_path_vec.buf
Expand All @@ -2459,16 +2459,16 @@ static void handle_deployment(
system_ret = system((char *) enable_command_vec.buf.data);
if (WIFEXITED(system_ret)) {
if (WEXITSTATUS(system_ret) != 0) {
GGL_LOGE("sudo systemctl enable failed");
GGL_LOGE("systemctl enable failed");
return;
}
GGL_LOGI(
"sudo systemctl enable exited with child status "
"systemctl enable exited with child status "
"%d\n",
WEXITSTATUS(system_ret)
);
} else {
GGL_LOGE("sudo systemctl enable did not exit normally");
GGL_LOGE("systemctl enable did not exit normally");
return;
}
}
Expand All @@ -2478,10 +2478,10 @@ static void handle_deployment(
static uint8_t reload_command_buf[PATH_MAX];
GglByteVec reload_command_vec = GGL_BYTE_VEC(reload_command_buf);
ret = ggl_byte_vec_append(
&reload_command_vec, GGL_STR("sudo systemctl daemon-reload\0")
&reload_command_vec, GGL_STR("systemctl daemon-reload\0")
);
if (ret != GGL_ERR_OK) {
GGL_LOGE("Failed to create sudo systemctl "
GGL_LOGE("Failed to create systemctl "
"daemon-reload command.");
return;
}
Expand All @@ -2490,17 +2490,17 @@ static void handle_deployment(
int system_ret = system((char *) reload_command_vec.buf.data);
if (WIFEXITED(system_ret)) {
if (WEXITSTATUS(system_ret) != 0) {
GGL_LOGE("sudo systemctl daemon-reload failed");
GGL_LOGE("systemctl daemon-reload failed");
return;
}
GGL_LOGI(
"sudo systemctl daemon-reload exited with child "
"systemctl daemon-reload exited with child "
"status "
"%d\n",
WEXITSTATUS(system_ret)
);
} else {
GGL_LOGE("sudo systemctl daemon-reload did not exit normally");
GGL_LOGE("systemctl daemon-reload did not exit normally");
return;
}
}
Expand Down Expand Up @@ -2728,7 +2728,7 @@ static void handle_deployment(
static uint8_t link_command_buf[PATH_MAX];
GglByteVec link_command_vec = GGL_BYTE_VEC(link_command_buf);
ret = ggl_byte_vec_append(
&link_command_vec, GGL_STR("sudo systemctl link ")
&link_command_vec, GGL_STR("systemctl link ")
);
ggl_byte_vec_chain_append(&ret, &link_command_vec, args->root_path);
ggl_byte_vec_chain_push(&ret, &link_command_vec, '/');
Expand Down Expand Up @@ -2759,7 +2759,7 @@ static void handle_deployment(
static uint8_t start_command_buf[PATH_MAX];
GglByteVec start_command_vec = GGL_BYTE_VEC(start_command_buf);
ret = ggl_byte_vec_append(
&start_command_vec, GGL_STR("sudo systemctl start ")
&start_command_vec, GGL_STR("systemctl start ")
);
ggl_byte_vec_chain_append(
&ret, &start_command_vec, service_file_path_vec.buf
Expand Down Expand Up @@ -2788,7 +2788,7 @@ static void handle_deployment(
static uint8_t enable_command_buf[PATH_MAX];
GglByteVec enable_command_vec = GGL_BYTE_VEC(enable_command_buf);
ret = ggl_byte_vec_append(
&enable_command_vec, GGL_STR("sudo systemctl enable ")
&enable_command_vec, GGL_STR("systemctl enable ")
);
ggl_byte_vec_chain_append(
&ret, &enable_command_vec, service_file_path_vec.buf
Expand Down

0 comments on commit 7d088f5

Please sign in to comment.