summaryrefslogtreecommitdiff
path: root/updater.lua
blob: 2eb739d683ba4e23c038910ddde0e4f21b90d1ad (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
local uci_cursor = uci.cursor(root_dir .. "/etc/config")

local board
local model = model or os_release["OPENWRT_DEVICE_PRODUCT"] or os_release["LEDE_DEVICE_PRODUCT"]
if model:match('[Mm]ox') then
	board = "mox"
elseif model:match('[Oo]mnia') then
	board = "omnia"
elseif model:match('Turris 1.x') then
	board = "turris1x"
else
	DIE("Unsupported board: " .. model)
end

local mode = uci_cursor:get("updater", "turris", "mode")
local animal = uci_cursor:get("updater", "turris", "branch")
if mode and mode ~= "branch" then
	WARN("Only branch mode allowed for personal-pkgs, used: " .. tostring(mode))
	return
end
if animal ~= "hbd" and animal ~= "hbl" and animal ~= "hbk" and animal ~= "hbt" then
	WARN("Unsupported branch for personal-pkgs: " .. tostring(animal))
	return
end

Repository("personal-pkgs", animal .. "/" .. board)

----------------------------------------------------------------------------------
Install("personal-pkgs-repo")
Package("personal-pkgs-repo", { replan = "finished" })

local tools = false
local vpn = false
local bigclown = false
local public = false

uci_cursor:foreach("system", "system", function(s) hostname = s['hostname'] end)
if hostname == "dean" then
	tools = true
	vpn = true
	Install("kmod-usb-net-asix-ax88179")
	Install("kmod-usb-serial-pl2303")
	Install("kmod-usb-serial-ftdi")
elseif hostname == "turris-home" then
	tools = true
	vpn = true
	public = true
	Install("mount-data")
	Install("transmission-daemon")
	Install("syncthing")
elseif hostname == "mox-home" then
	tools = true
	bigclown = true
elseif hostname:match("-home$") then
	tools = true
elseif hostname == "turris-adamkovi" then
	tools = true
	vpn = true
	public = true
	Install("etherwake")
elseif hostname:match("-adamkovi$") then
	tools = true
elseif hostname:match("^work-") then
	tools = true
end

if tools then
	Install("personal-enabler-common")
	Install("tree", "grep", "coreutils-sha256sum")
	Install("iperf", "iperf3")
	Install("sysstat", "strace")
	Install("shellrc")
	Install("mc", "htop", "iftop")
	Install("mmc-utils")
	if board == "omnia" then
		Install("personal-enabler-rainbow-omnia")
	end
	Install("healthcheck")
end
if vpn then
	Install("luci-app-openvpn", "openvpn-openssl")
	if animal == "hbk" or animal == "hbt" or animal == "hbs" then
		Install("luci-app-wireguard", "wireguard")
	else
		Install("luci-app-wireguard", "wireguard-tools")
	end
end
if bigclown then
	Install("bigclown-gateway", "bigclown-mqtt2influxdb", "bigclown-control-tool")
	Install("mosquitto", "mosquitto-client")
	Install("bigclown-leds")
end
if public then
	Install("personal-enabler-sentinel", "personal-enabler-public-ssh")
end