-
Notifications
You must be signed in to change notification settings - Fork 0
/
dosh.lua
44 lines (37 loc) · 1.3 KB
/
dosh.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- local cmd
local config_dir = "~/.config/"
cmd.add_task {
name = "setup",
description = "setup my operating system.",
required_platforms = { "macos" },
command = function()
-- copy all configuration folders
local config_dirs = cmd.ls(".", {
include_files = false,
excludes = { ".git", "archived", "home" }
})
for index = 1, #config_dirs do
cmd.copy(config_dirs[index], config_dir)
end
-- copy home files
cmd.copy("./home/*", "~")
end
}
cmd.add_task {
name = "fix-mosh",
description = "fix mosh permission issues.",
required_platforms = {"macos"},
command = function(arg)
local firepower = "sudo /usr/libexec/ApplicationFirewall/socketfilterfw"
-- temporarily shut firewall off
cmd.run(firepower .. " --setglobalstate off")
-- add symlinked location to firewall
cmd.run(firepower .. " --add $(which mosh-server)")
cmd.run(firepower .. " --unblockapp $(which mosh-server)")
-- add homebrew location to firewall
cmd.run(firepower .. " --add $(realpath $(which mosh-server))")
cmd.run(firepower .. " --unblockapp $(realpath $(which mosh-server))")
-- re-enable firewall
cmd.run(firepower .. " --setglobalstate on")
end
}