summarylogtreecommitdiffstats
path: root/sonarqube.install
blob: 9ee00e4d4ad529e4471edf7cb56ff876ef3ad59a (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# $Id$
# vim:set ts=2 sw=2 et:

# arg 1:  the new package version
pre_install() {
 /bin/true
}

# arg 1:  the new package version
post_install() {
  echo ">>> Creating user and group and setting permissions..."
  getent group sonar > /dev/null || usr/sbin/groupadd sonar
  getent passwd sonar > /dev/null || usr/sbin/useradd -c \
        'Sonar Code Quality metric system' -g sonar -d '/etc/sonarqube' \
        --system -s /bin/bash sonar &> /dev/null

  cd /usr/share/sonarqube

  chown -R sonar:sonar *
  chown -R sonar:sonar /etc/sonarqube
  chown -R sonar:sonar /var/run/sonarqube
  chown -R sonar:sonar /var/log/sonarqube

  cat << EOF
>>>
>>> Sonar can now be started via /usr/share/sonarqube/bin/sonar.sh or via
>>> systemctl start sonarqube.
>>>
>>> Sonar will run by default using the Derby embedded database, to change this
>>> to another database (e.g. MySql), please edit the
>>> /etc/sonarqube/sonar.properties accordingly.
>>>
>>> Sonar is running by default on port 9000 and is bound to all interfaces,
>>> you can change this in the file /etc/sonarqube/sonar.properties.
>>>
>>> For additional information please visit http://sonar.codehaus.org
>>>
>>> If you are upgrading from an earlier version, please read http://sonar.codehaus.org/
>>> and browse to http://localhost:9000/setup.
EOF
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
 /bin/true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  cd /usr/share/sonarqube

  chown -R sonar:sonar *
  chown -R sonar:sonar /etc/sonarqube
  chown -R sonar:sonar /var/run/sonarqube
  chown -R sonar:sonar /var/log/sonarqube
}

# arg 1:  the old package version
pre_remove() {
 /bin/true
}

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

	if [ -x /var/run/sonarqube ] ; then
	    rm -r /var/run/sonarqube
	fi
}