forked from TheHive-Project/TheHive
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rpm.sbt
46 lines (41 loc) · 1.6 KB
/
rpm.sbt
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
import Common.{stableVersion, snapshotVersion, betaVersion}
version in Rpm := {
version.value match {
case stableVersion(v1, v2) => v1
case betaVersion(v1, v2) => v1
case snapshotVersion(v1, v2) => v1
case _ => sys.error("Invalid version: " + version.value)
}
}
rpmRelease := {
version.value match {
case stableVersion(_, v2) => v2
case betaVersion(v1, v2) => "0.1RC" + v2
case snapshotVersion(v1, v2) => v2 + "-SNAPSHOT"
case _ => sys.error("Invalid version: " + version.value)
}
}
rpmVendor := organizationName.value
rpmUrl := organizationHomepage.value.map(_.toString)
rpmLicense := Some("AGPL")
rpmRequirements += "java-11-openjdk-headless"
maintainerScripts in Rpm := maintainerScriptsFromDirectory(
baseDirectory.value / "package" / "rpm",
Seq(RpmConstants.Pre, RpmConstants.Preun, RpmConstants.Postun)
)
linuxPackageSymlinks in Rpm := Nil
rpmPrefix := Some(defaultLinuxInstallLocation.value)
linuxEtcDefaultTemplate in Rpm := (baseDirectory.value / "package" / "etc_default_thehive").asURL
linuxPackageMappings in Rpm := configWithNoReplace((linuxPackageMappings in Rpm).value)
packageBin in Rpm := {
import scala.sys.process._
val rpmFile = (packageBin in Rpm).value
Process("rpm" ::
"--define" :: "_gpg_name TheHive Project" ::
"--define" :: "_signature gpg" ::
"--define" :: "__gpg_check_password_cmd /bin/true" ::
"--define" :: "__gpg_sign_cmd %{__gpg} gpg --batch --no-verbose --no-armor --use-agent --no-secmem-warning -u \"%{_gpg_name}\" -sbo %{__signature_filename} %{__plaintext_filename}" ::
"--addsign" :: rpmFile.toString ::
Nil).!!
rpmFile
}