This plugin provides Gradle-based assembly of DEB packages, typically for Linux distributions derived from Debian, e.g. Ubuntu. It leverages JDeb Java library.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.trigonic:gradle-rpm-plugin:2.0'
}
}
apply plugin: 'deb'
task fooRpm(type: Deb) {
release = 1
}
The DEB plugin provides a Task based on a standard copy task, similar to the Zip and Tar tasks. The power comes from specifying "from" and "into" calls, read more in the Copying files section of the Gradle documentation. On top of the standard available methods, there are some additional values that be set, which are specific to DEBs. Quite of them have defaults which fall back to fields on the project.
- packageName - Default to project.name
- release - DEB Release
- version - Version field, defaults to project.version
- user - Default user to permission files to
- permissionGroup - Default group to permission files to, "group" is used by Gradle for the display of tasks
- packageGroup
- buildHost
- summary
- packageDescription
- license
- packager
- distribution
- vendor
- url
- sourcePackage
- provides
- createDirectoryEntry [Boolean]
- uid - Default uid of files
- gid - Default gid of files
Symbolic links are specified via the links method, where the permissions umask is optional:
link(String src, String dest, int permissions)
Required packages are specified via the required method:
requires(String packageName, String version)
To provide the scripts traditionally seen in the spec files, they are provided as Strings or as files. Their corresponding methods can be called multiple times, and the contents will be appended in the order provided.
- preInstall
- postInstall
- preUninstall
- postUninstall
- installUtils - Scripts which are prefixed to all the other scripts.
The following attributes can be used inside from and into closures to complement the Copy Spec.
- user
- permissionGroup
- fileType
- uid
- gid
(Above can be set via property syntax, e.g. "user='jryan'", or method syntax, e.g. "user 'jryan'")
task fooRpm(type: Deb) {
packageName = 'foo'
version = '1.2.3'
release = 1
installUtils = file('scripts/rpm/utils.sh')
preInstall = file('scripts/rpm/preInstall.sh')
postInstall = file('scripts/rpm/postInstall.sh')
preUninstall = file('scripts/rpm/preUninstall.sh')
postUninstall = file('scripts/rpm/postUninstall.sh')
requires('bar', '2.2')
requires('baz', '1.0.1')
requires('qux')
into '/opt/foo'
from(jar.outputs.files) {
into 'lib'
}
from(configurations.runtime) {
into 'lib'
}
from('lib') {
into 'lib'
}
from('scripts') {
into 'bin'
exclude 'database'
fileMode = 0550
}
from('src/main/resources') {
fileType = CONFIG | NOREPLACE
into 'conf'
}
from('home') {
createDirectoryEntry = true
fileMode = 0500
into 'home'
}
from('endorsed') {
into '/usr/share/tomcat/endorsed'
}
link('/opt/foo/bin/foo.init', '/etc/init.d/foo')
}