summarylogtreecommitdiffstats
path: root/gitea.install
blob: 26a9e757fcb93b01cedf38249d47b3eed520d992 (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
30
31
32
33
34
35
36
37
38
39
pre_install() {
  if ! getent group gitea >/dev/null; then
    groupadd --system gitea
  fi
  if ! getent passwd gitea >/dev/null; then
    useradd -m --system -c 'gitea daemon users' -g gitea -s /bin/false gitea -d /var/lib/gitea
  fi
  chsh gitea -s /bin/bash
}

post_install(){
  chown -R gitea:gitea /var/log/gitea
  chown -R gitea:gitea /var/lib/gitea
  chown -R gitea:gitea /etc/gitea

  systemctl daemon-reload
}

pre_upgrade(){
  pre_install $1
}

post_upgrade() {
  post_install $1
}

pre_remove() {
  systemctl stop gitea.service
  systemctl disable gitea.service
}

post_remove() {
  if getent passwd gitea >/dev/null; then
    userdel -r gitea
  fi
  if getent group gitea >/dev/null; then
    groupdel gitea
  fi
}