summarylogtreecommitdiffstats
path: root/nexus.install
blob: 295721dcff6a791b01dcffcab7a20b2be7aed413 (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
75
76
77
78
79
80
81
82
83
#!/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() {
  ln -s /opt/nexus/bin/nexus /etc/rc.d/nexus

  echo ">>> Creating user and group and setting permissions..."
  getent group nexus > /dev/null || usr/sbin/groupadd nexus
  getent passwd nexus > /dev/null || usr/sbin/useradd -c \
        'Maven Repository Manager' -g nexus -d '/opt/nexus' \
        --system -s /bin/bash nexus &> /dev/null

  cd opt/nexus

  chown -R nexus:nexus * 
  chown -R nexus:nexus /opt/sonatype-work/
  chown -R nexus:nexus /opt/nexus 
  chown -R nexus:nexus /opt/nexus/run

  cat << EOF
>>>
>>>                      Systemd service file added
>>> If you would like to start it on system startup, please enable it by 
>>> systemctl enable nexus.service
>>>
>>> Nexus is running by default on port 8081 and is bound to all interfaces,
>>> you can change this in the nexus.properties as well. 
>>>
>>> The nexus.log can be found in /opt/nexus/logs.
>>>
>>> For additional information please visit http://nexus.sonatype.org
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 opt/nexus

  chown -R nexus:nexus * 
  chown -R nexus:nexus /opt/sonatype-work
  chown -R nexus:nexus /opt/nexus 
  chown -R nexus:nexus /opt/nexus/run

}

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

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

	if [ -d /opt/nexus/run ] ; then
	    rm -r /opt/nexus/run
	fi  

	if [ -d /opt/sonatype-work ] ; then
	    rm -r /opt/sonatype-work
	fi  

	if [ -h /etc/rc.d/nexus ] ; then
	    rm /etc/rc.d/nexus
	fi  

}