summarylogtreecommitdiffstats
path: root/adguardhome-bin.install
diff options
context:
space:
mode:
authorJuan Simon2020-01-01 18:04:46 +0100
committerJuan Simon2020-01-01 18:04:46 +0100
commita7c15fb92ec07f1466ae1472a69c574137e450ba (patch)
treee2b4950350c73cdf2082526edd3314236c1a89f3 /adguardhome-bin.install
downloadaur-a7c15fb92ec07f1466ae1472a69c574137e450ba.tar.gz
Initial release
Diffstat (limited to 'adguardhome-bin.install')
-rw-r--r--adguardhome-bin.install27
1 files changed, 27 insertions, 0 deletions
diff --git a/adguardhome-bin.install b/adguardhome-bin.install
new file mode 100644
index 000000000000..092fede6ddf7
--- /dev/null
+++ b/adguardhome-bin.install
@@ -0,0 +1,27 @@
+post_install() {
+ getent group adguardhome > /dev/null || groupadd -g 555 adguardhome
+ if ! getent passwd adguardhome > /dev/null; then
+ useradd -c 'adguardhome user' -u 555 -g adguardhome \
+ -d /var/lib/adguardhome -s /usr/bin/nologin adguardhome
+ passwd -l adguardhome > /dev/null
+ [[ ! -d /var/lib/adguardhome/ ]] &&
+ mkdir /var/lib/adguardhome/ &&
+ chown -R adguardhome:adguardhome /var/lib/adguardhome/
+ fi
+
+ post_upgrade
+}
+
+post_upgrade() {
+ setcap CAP_NET_BIND_SERVICE=+eip /var/lib/adguardhome/AdGuardHome
+}
+
+post_remove() {
+ echo "==> Optionally delete the adguardhome user and its home directory"
+ echo "==> if you are certain no processes are running under it."
+ echo "==> userdel adguardhome"
+ echo "==> groupdel adguardhome"
+ echo "==> rm -rf /var/lib/adguardhome"
+}
+
+# vim:set ts=2 sw=2 et: