summarylogtreecommitdiffstats
path: root/nexus-oss.install
blob: 4fff444791cbbf08077ac5547cbe1062be68fa2b (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
show_release_notes()
{
	cat <<EOF

Starting with version 3.71.0, Nexus Repository will no longer support
OrientDB, Java 8, or Java 11.

You must migrate to H2 before upgrading to version 3.71.0. Review the
upgrade instructions for versions 3.71.0 and beyond at:

    https://help.sonatype.com/en/orient-3-70-java-8-or-11.html

If enabled, Nexus OSS service will be stopped and disabled, you can
enable it manually after migration.

You can find nexus-db-migrator.jar in "/usr/lib/nexus-oss/bin". Make sure
you use Java-11 for migration, or the migration will fail.

BACKUP everything before anything else!!!

EOF
}

ver_lt()
{
	if [[ $(vercmp ${1%-*} ${2%-*}) -eq -1 ]]; then
		return 0
	else
		return 1
	fi
}

migration_done()
{
	if ! grep -q '^nexus.datastore.enabled=true' /var/lib/nexus-oss/etc/nexus.properties; then
		logger -p error -s -t nexus-oss.pre-upgrade Nexus OSS still on OrionDB

		return 1
	fi

	return 0
}

post_install()
{
	systemd-sysusers nexus-oss.conf
	systemd-tmpfiles --create nexus-oss.conf

	show_release_notes
}

post_upgrade()
{
	local new_version=$1
	local old_version=$2

	if ver_lt $old_version $new_version || ! migration_done; then
		show_release_notes

		systemctl stop nexus-oss
		systemctl disable nexus-oss
	else
		systemctl daemon-reload
	fi
}

pre_remove()
{
	systemctl disable --now nexus-oss
}

post_remove()
{
	systemctl daemon-reload
}