summarylogtreecommitdiffstats
path: root/drone.install
blob: 2f67348542fbcc42c65630cd821e52ff917e253b (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
40
41
42
43
44
45
46
47
48
49
50
## arg 1:  the new package version
pre_install() {
  echo "Installing Drone CI"
}

## arg 1:  the new package version
post_install() {
  echo "Adding drone user"

  getent group drone &>/dev/null || groupadd -g 633 drone &>/dev/null
  getent passwd drone &>/dev/null || useradd -u 633 -g drone -s /sbin/nologin \
    -d /var/lib/drone drone &>/dev/null

  # add drone to docker group
  gpasswd -a drone docker

  echo "---------------------------------------------------------"
  echo "1. Remember to modify the drone config: /etc/drone/server"
  echo "2. Remember to start docker: systemctl start docker"
  echo "3. You need at least one auth provider [github/bitbucker/gitlab] enabled in /etc/drone/server"
  echo "4. Remember to start a drone agent. You can run a local agent with systemctl start drone-agent"
  echo ""
  echo "You can enable all by: systemctl enable docker drone drone-agent"
  echo "---------------------------------------------------------"
}

## arg 1:  the new package version
## arg 2:  the old package version
pre_upgrade() {
  echo "Upgrading Drone CI"
}

## arg 1:  the new package version
## arg 2:  the old package version
post_upgrade() {
  post_install
}

## arg 1:  the old package version
pre_remove() {
  echo "Removing Drone CI"
}

## arg 1:  the old package version
post_remove() {
  getent passwd drone &>/dev/null && userdel drone >/dev/null
  getent group drone &>/dev/null && groupdel drone >/dev/null
}

# vim:set ts=2 sw=2 et: