aboutsummarylogtreecommitdiffstats
path: root/caddy.install
blob: 4cf909f0902ffc271cb6b21d51e889d7fcde8232 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
post_install() {
  # Create the caddy user/group if they don't exist
  if ! getent group caddy >/dev/null; then
    groupadd --system caddy
  fi
  if ! getent passwd caddy >/dev/null; then
    useradd --system --gid caddy --create-home --home-dir /var/lib/caddy \
      --shell /usr/bin/nologin --comment "Caddy web server" caddy
  fi

  # Set initial permissions for the config and data dirs
  chown -R caddy:caddy /etc/caddy /var/lib/caddy 2>/dev/null || true

  echo "==> Caddy Web Server is now installed!!"
  echo "==> Edit /etc/caddy/Caddyfile and start the service using:"
  echo "==> systemctl enable --now caddy or"
  echo "==> systemctl enable caddy"
  echo "==> systemctl start caddy"
}

post_upgrade() {
  post_install
}