-
Notifications
You must be signed in to change notification settings - Fork 75
feat: Generate Debian packages with CPack #2282
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
553e011
feature: Generate Debian packages with CPack
legleux 8dec87c
update build image
legleux 2ee96da
PR comments
legleux a4b9908
How was that still true?
legleux cb4a54b
adduser-->useradd
legleux 5b66737
f
legleux 8e9300c
Add some comments
legleux 263dc25
Move a comment; add a variable
legleux ddeec83
Update postinst
mathbunnyru 6fb8c13
Update ClioVersion.cmake
mathbunnyru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| include("${CMAKE_CURRENT_LIST_DIR}/ClioVersion.cmake") | ||
|
|
||
| set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/clio") | ||
| set(CPACK_PACKAGE_VERSION "${CLIO_VERSION}") | ||
| set(CPACK_STRIP_FILES TRUE) | ||
|
|
||
| include(pkg/deb) | ||
| include(CPack) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| set(CLIO_INSTALL_DIR "/opt/clio") | ||
| set(CMAKE_INSTALL_PREFIX ${CLIO_INSTALL_DIR}) | ||
| set(CMAKE_INSTALL_PREFIX "${CLIO_INSTALL_DIR}" CACHE PATH "Install prefix" FORCE) | ||
|
|
||
| install(TARGETS clio_server DESTINATION bin) | ||
| set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") | ||
|
|
||
| include(GNUInstallDirs) | ||
|
|
||
| install(TARGETS clio_server DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
|
|
||
| file(READ docs/examples/config/example-config.json config) | ||
| string(REGEX REPLACE "./clio_log" "/var/log/clio/" config "${config}") | ||
| file(WRITE ${CMAKE_BINARY_DIR}/install-config.json "${config}") | ||
| install(FILES ${CMAKE_BINARY_DIR}/install-config.json DESTINATION etc RENAME config.json) | ||
|
|
||
| configure_file("${CMAKE_SOURCE_DIR}/cmake/install/clio.service.in" "${CMAKE_BINARY_DIR}/clio.service") | ||
|
|
||
| install(FILES "${CMAKE_BINARY_DIR}/clio.service" DESTINATION /lib/systemd/system) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| set(CPACK_GENERATOR "DEB") | ||
| set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/XRPLF/clio") | ||
| set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Ripple Labs Inc. <support@ripple.com>") | ||
|
|
||
| set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) | ||
|
|
||
| set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) | ||
|
|
||
| set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_SOURCE_DIR}/cmake/pkg/postinst) | ||
|
|
||
| # We must replace "-" with "~" otherwise dpkg will sort "X.Y.Z-b1" as greater than "X.Y.Z" | ||
| string(REPLACE "-" "~" git "${CPACK_PACKAGE_VERSION}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| USER_NAME=clio | ||
| GROUP_NAME="${USER_NAME}" | ||
| CLIO_EXECUTABLE="clio_server" | ||
| CLIO_PREFIX="/opt/clio" | ||
| CLIO_BIN="$CLIO_PREFIX/bin/${CLIO_EXECUTABLE}" | ||
| CLIO_CONFIG="$CLIO_PREFIX/etc/config.json" | ||
|
|
||
| case "$1" in | ||
| configure) | ||
| if ! id -u "$USER_NAME" >/dev/null 2>&1; then | ||
| # Users who should not have a home directory should have their home directory set to /nonexistent | ||
| # https://www.debian.org/doc/debian-policy/ch-opersys.html#non-existent-home-directories | ||
| useradd \ | ||
| --system \ | ||
| --home-dir /nonexistent \ | ||
| --no-create-home \ | ||
| --shell /usr/sbin/nologin \ | ||
| --comment "system user for ${CLIO_EXECUTABLE}" \ | ||
| --user-group \ | ||
| ${USER_NAME} | ||
| fi | ||
|
|
||
| install -d -o "$USER_NAME" -g "$GROUP_NAME" /var/log/clio | ||
|
|
||
| if [ -f "$CLIO_CONFIG" ]; then | ||
| chown "$USER_NAME:$GROUP_NAME" "$CLIO_CONFIG" | ||
| fi | ||
|
|
||
| chown -R "$USER_NAME:$GROUP_NAME" "$CLIO_PREFIX" | ||
|
|
||
| ln -sf "$CLIO_BIN" "/usr/bin/${CLIO_EXECUTABLE}" | ||
|
|
||
| ;; | ||
| abort-upgrade|abort-remove|abort-deconfigure) | ||
| ;; | ||
| *) | ||
| echo "postinst called with unknown argument \`$1'" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to escape this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, fixed in #2469
Also, fixed some rename issues we had
@legleux just for the future, I think it is be better to rename variables separately as a refactor, to not miss places where rename is needed