@@ -5,6 +5,7 @@ package rpm
5
5
import Keys ._
6
6
import linux ._
7
7
import sbt ._
8
+ import java .nio .charset .Charset
8
9
9
10
/** Plugin trait containing all generic values used for packaging linux software. */
10
11
trait RpmPlugin extends Plugin with LinuxPlugin {
@@ -34,6 +35,7 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
34
35
rpmPosttrans := None ,
35
36
rpmPreun := None ,
36
37
rpmPostun := None ,
38
+ rpmBrpJavaRepackJars := false ,
37
39
packageSummary in Rpm <<= packageSummary in Linux ,
38
40
packageDescription in Rpm <<= packageDescription in Linux ,
39
41
target in Rpm <<= target(_ / " rpm" )
@@ -45,6 +47,12 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
45
47
(rpmLicense, rpmDistribution, rpmUrl, rpmGroup, rpmPackager, rpmIcon) apply RpmDescription ,
46
48
rpmDependencies <<=
47
49
(rpmProvides, rpmRequirements, rpmPrerequisites, rpmObsoletes, rpmConflicts) apply RpmDependencies ,
50
+ rpmPre <<= (rpmPre, rpmBrpJavaRepackJars) apply {
51
+ case (_, true ) => None
52
+ case (pre, false ) =>
53
+ val scriptBits = IO .readStream(RpmPlugin .osPostInstallMacro.openStream, Charset forName " UTF-8" )
54
+ Some (pre.map(_ + " \n " ).getOrElse(" " ) + scriptBits)
55
+ },
48
56
rpmScripts <<=
49
57
(rpmPretrans, rpmPre, rpmPost, rpmVerifyscript, rpmPosttrans, rpmPreun, rpmPostun) apply RpmScripts ,
50
58
rpmSpecConfig <<=
@@ -64,8 +72,9 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
64
72
65
73
object RpmPlugin {
66
74
67
- def preinstTemplateSource : java.net.URL = getClass.getResource(" preinstall" )
68
- def postinstTemplateSource : java.net.URL = getClass.getResource(" postinstall" )
69
- def preuninstallTemplateSource : java.net.URL = getClass.getResource(" preuninstall" )
70
- def postuninstallTemplateSource : java.net.URL = getClass.getResource(" postuninstall" )
75
+ def preinstTemplateSource : java.net.URL = getClass getResource " preinstall"
76
+ def postinstTemplateSource : java.net.URL = getClass getResource " postinstall"
77
+ def preuninstallTemplateSource : java.net.URL = getClass getResource " preuninstall"
78
+ def postuninstallTemplateSource : java.net.URL = getClass getResource " postuninstall"
79
+ def osPostInstallMacro : java.net.URL = getClass getResource " brpJavaRepackJar"
71
80
}
0 commit comments