remove absolute paths when executing binaries

we set the paths manually, so this is ok

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2020-06-15 11:16:11 +02:00
committed by Dietmar Maurer
parent 0b99e5aebc
commit cbef49bf4f
9 changed files with 20 additions and 28 deletions

View File

@ -7,8 +7,6 @@ pub mod time;
use anyhow::{bail, Error};
pub const SYSTEMCTL_BIN_PATH: &str = "/usr/bin/systemctl";
/// Escape strings for usage in systemd unit names
pub fn escape_unit(mut unit: &str, is_path: bool) -> String {
@ -77,7 +75,7 @@ pub fn unescape_unit(text: &str) -> Result<String, Error> {
pub fn reload_daemon() -> Result<(), Error> {
let mut command = std::process::Command::new(SYSTEMCTL_BIN_PATH);
let mut command = std::process::Command::new("systemctl");
command.arg("daemon-reload");
crate::tools::run_command(command, None)?;
@ -87,7 +85,7 @@ pub fn reload_daemon() -> Result<(), Error> {
pub fn enable_unit(unit: &str) -> Result<(), Error> {
let mut command = std::process::Command::new(SYSTEMCTL_BIN_PATH);
let mut command = std::process::Command::new("systemctl");
command.arg("enable");
command.arg(unit);
@ -98,7 +96,7 @@ pub fn enable_unit(unit: &str) -> Result<(), Error> {
pub fn start_unit(unit: &str) -> Result<(), Error> {
let mut command = std::process::Command::new(SYSTEMCTL_BIN_PATH);
let mut command = std::process::Command::new("systemctl");
command.arg("start");
command.arg(unit);
@ -109,7 +107,7 @@ pub fn start_unit(unit: &str) -> Result<(), Error> {
pub fn stop_unit(unit: &str) -> Result<(), Error> {
let mut command = std::process::Command::new(SYSTEMCTL_BIN_PATH);
let mut command = std::process::Command::new("systemctl");
command.arg("stop");
command.arg(unit);