post_install() { if ! getent group dnscrypt &>/dev/null; then groupadd -r dnscrypt >/dev/null fi if ! getent passwd dnscrypt &>/dev/null; then useradd -r -g dnscrypt -G adm -d /dev/null -s /bin/nologin dnscrypt >/dev/null fi if ! groups dnscrypt | grep adm &>/dev/null; then gpasswd -a dnscrypt adm >/dev/null fi dnscrypt_shell=$(getent passwd dnscrypt | cut -d: -f7) if [ "$dnscrypt_shell" != '/bin/nologin' ]; then chsh -s /bin/nologin dnscrypt &>/dev/null fi echo '>>> DNSCrypt, add next line inside of /etc/dhcpcd.conf' echo '>>> static domain_name_servers=127.0.0.1::1' } post_upgrade() { post_install if (( $(vercmp $2 2.0.0-1) < 0 )); then echo '>>> The configuration file(s) and setup of DNSCrypt has changed considerably since version 1.x.' echo '>>> Please refer to https://dnscrypt.info/doc for help!' fi } post_remove() { if getent passwd dnscrypt &>/dev/null; then userdel dnscrypt >/dev/null fi if getent group dnscrypt &>/dev/null; then groupdel dnscrypt >/dev/null fi }