summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-nixio/root/lib/upgrade/luci-add-conffiles.sh
blob: d5117f9d89e9ac6c1b6a0d31b6c17948d074ac3e (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
add_luci_conffiles()
{
	add_luci_conffiles_helper()
	{
		[ ! -f "$1" ] && return
		grep -q "$1" "$2" && return
		echo "$1" >> "$2"
	}

	local filelist="$1"

	# save ssl certs
	if [ -d /etc/nixio ]; then
		find /etc/nixio -type f | while read ff; do
			add_luci_conffiles_helper "$ff" "$filelist"
		done
	fi

	# save uhttpd certs
	add_luci_conffiles_helper /etc/uhttpd.key "$filelist"
	add_luci_conffiles_helper /etc/uhttpd.crt "$filelist"

	unset -f add_luci_conffiles_helper
}

sysupgrade_init_conffiles="$sysupgrade_init_conffiles add_luci_conffiles"