task unzip(type: Copy) { from zipTree(downloadTask.dest) into file("${buildDir}/unpacked/dist") eachFile { FileCopyDetails fcd -> fcd.path = fcd.path.substring(path.indexOf('/')+1) } } unzip.dependsOn(downloadTask) ospackage { into "/opt/${project.name}" from unzip.outputs.files }