summarylogtreecommitdiffstats
path: root/duckdns.install
blob: d8a9afebd20152ba18326ad0614ef04c45ce76e8 (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
_pkgname="duckdns"

post_install() {
	if ! getent group "${_pkgname}" &>/dev/null; then
		echo ":: Adding ${_pkgname} system group..."
		groupadd --system "${_pkgname}" 1>/dev/null
	fi

	if ! getent passwd "${_pkgname}" &>/dev/null; then
		echo ":: Adding ${_pkgname} system user..."
		useradd \
			--system \
			--gid "${_pkgname}" \
			--home-dir "/etc/${_pkgname}.d" \
			"${_pkgname}" 1>/dev/null
	fi

	chown -R "${_pkgname}:${_pkgname}" "/etc/${_pkgname}.d"
	echo "Don't forget to edit /etc/${_pkgname}.d/default in order to provide your domain names, token and IP address providers!"
}

post_upgrade() {
	chown -R "${_pkgname}:${_pkgname}" "/etc/${_pkgname}.d"
}

post_remove() {
	[ -d "/etc/${_pkgname}.d" ] && echo ":: Configuration files in /etc/${_pkgname}.d were preserved."
	echo ":: The ${_pkgname} user and group were preserved."
}