Wednesday, April 20, 2022

[SOLVED] How to create an rpm out of sbt

Issue

I have a script named post_install.sh and it is present in src/main/scripts/post_install.sh. My sbt file is

import com.typesafe.sbt.packager.rpm.RpmPlugin.autoImport.RpmConstants._
maintainerScripts in Rpm := maintainerScriptsAppendFromFile((maintainerScripts in Rpm).value)(
  Post -> (baseDirectory.value / "scripts" / "install" / "post-install.sh")
)

When I run sbt rpm:packageBin I get the following error

[error] (rpm:maintainerScripts) The maintainer script post doesn't exist here: /Users/spachari/IdeaProjects/aws-customer-email-change-history/scripts/install/post-install.sh

Please tell me how do you create an rpm from sbt package.


Solution

Just looking at your error it seems that your baseDirectory is /Users/spachari/IdeaProjects/aws-customer-email-change-history and the script is really at /Users/spachari/IdeaProjects/aws-customer-email-change-history/src/main/scripts/post_install.sh. So you may try to change your code to

import com.typesafe.sbt.packager.rpm.RpmPlugin.autoImport.RpmConstants._
maintainerScripts in Rpm := maintainerScriptsAppendFromFile((maintainerScripts in Rpm).value)(
  Post -> (baseDirectory.value / "src" / "main" / "scripts" / "post-install.sh")
)

assuming that the script located at the directory works correctly from it.



Answered By - SergGr
Answer Checked By - Terry (WPSolving Volunteer)