Skip to content

ospackage and/or buildDeb into() doesn't seem to work #448

@niclash

Description

@niclash

I have been trying to upgrade a slightly older project from ospackage ver 8.5.6 to something that is at all available (8.5.6 is removed from Maven repository) and I can't get it to generate the same Debian package.

I have run out of things to try, to get the output to be generated into the /opt/link2web/fvc1/ directory, and I only get it in the /opt/fvc1/ directory. I can get a copy of it by adding

  from("build/install/fvc1") {
    into("/opt/link2web/fvc1")
  }

but on the RaspberryPi systems this is running, diskspace is very tight and adding a copy of all jars is not an option.

I have checked a handful of random Github projects that uses ospackage to generate into some other directory, but none of the one's I picked can even compile at all (possibly because not setting the version, and getting a later "broken" version).

I am at my wit's end and running out of time.

"Working" build.gradle with 8.5.6

/*
 * Copyright (c) 1996-2022 Bali Automation. All Rights Reserved.
 */


buildscript {
  repositories {
    mavenCentral()
  }
}

plugins {
  id "nebula.release" version "15.3.1"
  id "nebula.ospackage" version "8.5.6"
}

apply from: 'dependencies.gradle'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'

group 'link2web'

repositories {
  mavenLocal()
  mavenCentral()
  maven { url 'https://maven.restlet.talend.com/' }
}


java {
  sourceCompatibility = JavaVersion.VERSION_11
  targetCompatibility = JavaVersion.VERSION_11
}

compileJava {
  options.encoding = 'UTF-8'
  inputs.property("moduleName", project.name)
  doFirst {
    options.compilerArgs = [
            '--module-path', classpath.asPath,
    ]
    classpath = files()
  }
}

dependencies {
  implementation libraries.slf4j
  implementation libraries.logback

  testImplementation group: 'junit', name: 'junit', version: '4.12'
  testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
  testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
}
if (tasks.findByName("distZip")) {
  rootProject.tasks.release.dependsOn tasks.distZip
}

tasks.release.dependsOn tasks.assemble

apply plugin: 'application'
apply plugin: 'nebula.release'
apply plugin: 'nebula.deb'
apply plugin: 'nebula.ospackage'
apply plugin: 'nebula.ospackage-base'
apply plugin: 'nebula.ospackage-daemon'
apply plugin: 'nebula.ospackage-application'

mainClassName = 'io.bali.core.Core'
applicationDefaultJvmArgs = ['-Xmx512M']

repositories {
  mavenLocal()
  mavenCentral()
}

dependencies {
  implementation libraries.j2mod
  implementation libraries.jetty_client
  implementation libraries.jackson
  implementation libraries.link2web
  implementation libraries.logback
  implementation libraries.paho
  implementation libraries.pi4j
  libraries.restlet.forEach {
    implementation(it) {
      exclude group: 'org.codehaus.woodstox'
    }
  }
}

ospackage_application {
  prefix = '/opt/link2web/'
}

run {
  workingDir = "src/main/dist"
}

ospackage {
  user = "link2web"

  def names = []
  fileTree("src/main/conf").visit { FileVisitDetails details ->
    if (!details.directory) {
      names << "/etc/link2web/$project.name/" + details.relativePath
    }
  }
  configurationFile names.join("\n")

  postInstall file('src/main/scripts/post-install.sh')
  preUninstall file('src/main/scripts/pre-uninstall.sh')

  into '/opt/link2web'

  from('bin') {
    fileType = CONFIG | NOREPLACE
    into 'bin'
  }

  from('src/main/dist/resources') {
    into '/opt/link2web/' + project.name + "/resources"
  }

  from(jar.outputs.files) {
    into '/opt/link2web/' + project.name + '/lib'
  }

  from('src/main/dist/lib') {
    into '/opt/link2web/' + project.name + '/lib'
  }

  from('src/main/conf') {
    fileType = CONFIG | NOREPLACE
    include "*/**"
    exclude "*backup*"
    into '/etc/link2web/' + project.name + '/'
  }

  from('src/main/data/stores') {
    fileType = CONFIG | NOREPLACE
    into '/var/lib/link2web/' + project.name + '/stores'
  }

  from('src/main/data/dummy') {
    fileType = CONFIG | NOREPLACE
    into '/var/lib/link2web/' + project.name + '/hist/'
  }

  from('src/main/web') {
    fileType = CONFIG | NOREPLACE
    into '/var/www/link2web/' + project.name + '/'
  }

  from('src/main/conf/parameters.properties') {
    fileType = CONFIG | NOREPLACE
    into '/etc/link2web/' + project.name
  }
}

task packDeb(type: Deb) {
}

buildDeb {
  requires("openjdk-11-jre-headless")
  requires("exim4-daemon-light")
  requires("mailutils")
  requires("libpigpio-dev")
  requires("libpigpio1")
  link('/etc/systemd/system/' + project.name + '.service', '/opt/link2web/' + project.name + '/bin/' + project.name + '.service')
  link('/var/lib/link2web/' + project.name + '/parameters.properties', '/etc/link2web/' + project.name + '/parameters.properties')
}

assemble.dependsOn buildDeb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions