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

Support for relocatable RPMs #661

Merged
merged 1 commit into from
Sep 4, 2015
Merged

Conversation

fsat
Copy link
Collaborator

@fsat fsat commented Sep 4, 2015

Save the value of RPM_INSTALL_PREFIX into application's sysconfig file.

Upon application start up, look for this value, else use the chdir value supplied via sbt templates.

I have two options in detecting where the RPM package is installed.

Option 1: Use RPM_INSTALL_PREFIX provided during installation process

The RPM_INSTALL_PREFIX environment variable is only provided during the install time. This value would need to be persisted so it can be retrieved during application start-up.

Option 2: Use rpm command

The command rpm -q --queryformat "%{INSTPREFIXES}" ${{app_name}} will print out the location where the package is installed. This command works for both Redhat 6 and 7.

I have decided to go with Option 1 because we are using the values provided to us by the operating system instead of trying to deduce this value ourselves.

The downside of this approach is:

  • I am persisting the value of RPM_INSTALL_PREFIX in the /etc/sysconfig/${{app_name}}.
  • I need to replace this information at re-install time or upgrade time.

@muuki88 and @edwardcallahan - can I get your thoughts on my approach please? Happy to change if you think Option 2 is a better way to move forward.

@fsat
Copy link
Collaborator Author

fsat commented Sep 4, 2015

@fsat
Copy link
Collaborator Author

fsat commented Sep 4, 2015

I have done a manual test with the following steps:

  • Override the preinst and start with the original content from sbt-native-packager + changes I have introduced applied.
  • Generate rpm package
  • Install rpm package into default path, e.g. sudo rpm -i conductr-0.1.0-1.noarch.rpm
  • Ensure process are started correctly with package files created into the correct locations.
  • Uninstall the package.
  • Re-install rpm package into relocated path, e.g. sudo rpm -i conductr-0.1.0-1.noarch.rpm --relocate /usr/share=/opt
  • Ensure process are started correctly with package files created into the correct locations.

The manual test has been done on Redhat 7.

@huntc
Copy link
Contributor

huntc commented Sep 4, 2015

Using -z for tests is better.

Otherwise LGTM - @muuki88 - WDYT?

Save the value of `RPM_INSTALL_PREFIX` into application's sysconfig file.

Upon application start up, look for this value, else use the `chdir` value
supplied via sbt templates.
@fsat fsat force-pushed the relocatable-rpm-support branch from 9e1f7d8 to e6a1e13 Compare September 4, 2015 05:07
@fsat
Copy link
Collaborator Author

fsat commented Sep 4, 2015

Used -n instead since I'd like to check for non-empty string, also shorten the if clause where possible.

@fsat fsat changed the title WIP - DON'T MERGE - Support for relocatable RPMs Support for relocatable RPMs Sep 4, 2015
@fsat
Copy link
Collaborator Author

fsat commented Sep 4, 2015

Manual test also done successfully on Redhat 6.

@muuki88 muuki88 added the rpm label Sep 4, 2015
muuki88 added a commit that referenced this pull request Sep 4, 2015
@muuki88 muuki88 merged commit 8e5a2cc into sbt:master Sep 4, 2015
@muuki88
Copy link
Contributor

muuki88 commented Sep 4, 2015

LGTM.

fsat added a commit to fsat/sbt-native-packager that referenced this pull request Sep 7, 2015
This test asserts the behaviour added by sbt#661
fsat added a commit to fsat/sbt-native-packager that referenced this pull request Sep 11, 2015
…ased distribution

Reinstate the fix in PR sbt#653 that was accidentally removed by PR sbt#661
littleRoundaer pushed a commit to littleRoundaer/sbt-native-packager that referenced this pull request Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants