Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM relocation - requires local ownership of sbt-native-packager source templates #659

Closed
edwardcallahan opened this issue Sep 1, 2015 · 4 comments

Comments

@edwardcallahan
Copy link

When using rpmPrefix to make a package relocatable, one must also take ownership of the init start script and scriptlets.

The current doc for rpmPrefix has had rpmChangelogFile inserted into the 'how to enable relocation' story. From https://github.com/sbt/sbt-native-packager/pull/242/files we learn that one must also copy the init script out of sbt-native-packager into the project source in order to get a functioning init script when relocated (the stock script uses the default path in exec). This is presented under Template Changes with: "Apply the following changes to the default init start script. You can find this in the sbt-native-packager source." This is not only a template customization example, but is also required in order to have a relocatable package that will start.

Copying sbt-native-packager sources into a project source is highly undesirable. Could the templates use PACKAGE_PREFIX instead of chdir, for example?

@muuki88
Copy link
Contributor

muuki88 commented Sep 1, 2015

I haven't used the prefix myself yet. So to get it working you have to

  • set the rpmPrefix value
  • override scriptlets
  • copy the (systemV?) initScript

The ${PACKAGE_PREFIX} has to be inserted "by hand", right?
First thing that comes to mind is, changing the linuxScriptReplacements. {{chdir}} could be set to the relocated location? Or what else does this relocation do?

@edwardcallahan
Copy link
Author

I got as far as:

  • set defaultLinuxInstallLocation
  • set rpmPrefix
  • set linuxPackageSymlinks (tip: use show linuxPackageSymlinks to get them all!)
  • set defaultLinuxLogsLocation
    This resulted in a relocatable package, but with an invalid init script.

As I understand the doc, yes, next I would need to copy start-rpm-template into the project tree and edit it to use ${PACKAGE_PREFIX} instead of ${{chdir}} for exec. With same for the scriptlet changes for post-rpm and reun-rpm.

Yes, setting {{chdir}} to the user specified location should also work. Relocation let's the user specify an alternative install location (i.e. rpm -i --relocate /usr/share=/opt mypackage.rpm). The relocation works, it's the reflection of the user chosen path in the (systemV) scripts that's been the sticky wicket.

@fsat
Copy link
Collaborator

fsat commented Sep 14, 2015

@muuki88 - maybe we can close this after 1.0.5 release since it's fixed by #661

@muuki88
Copy link
Contributor

muuki88 commented Sep 14, 2015

Yeah. Think so

@muuki88 muuki88 closed this as completed Sep 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants