style: re-format
This commit is contained in:
+13
-13
@@ -2,30 +2,30 @@ local utils = require("lua.lib.utils")
|
||||
local M = {}
|
||||
|
||||
function M.is_user_unit_exists(unit)
|
||||
return utils.command_success("systemctl --user cat " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
|
||||
return utils.command_success("systemctl --user cat " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
|
||||
end
|
||||
|
||||
M.user_unit_dir = CONFIG_HOME .. "/systemd/user"
|
||||
|
||||
function M.ensure_user_unit(unit, source)
|
||||
if M.is_user_unit_exists(unit) then
|
||||
return true
|
||||
end
|
||||
if M.is_user_unit_exists(unit) then
|
||||
return true
|
||||
end
|
||||
|
||||
local target_dir = M.user_unit_dir
|
||||
local target = target_dir .. "/" .. unit
|
||||
local target_dir = M.user_unit_dir
|
||||
local target = target_dir .. "/" .. unit
|
||||
|
||||
local cmd = table.concat({
|
||||
"mkdir -p " .. utils.shell_quote(target_dir),
|
||||
"ln -s " .. utils.shell_quote(source) .. " " .. utils.shell_quote(target),
|
||||
"systemctl --user daemon-reload",
|
||||
}, " && ")
|
||||
local cmd = table.concat({
|
||||
"mkdir -p " .. utils.shell_quote(target_dir),
|
||||
"ln -s " .. utils.shell_quote(source) .. " " .. utils.shell_quote(target),
|
||||
"systemctl --user daemon-reload",
|
||||
}, " && ")
|
||||
|
||||
return utils.command_success(cmd)
|
||||
return utils.command_success(cmd)
|
||||
end
|
||||
|
||||
function M.start_user_unit(unit)
|
||||
return utils.command_success("systemctl --user start " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
|
||||
return utils.command_success("systemctl --user start " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user