-
Notifications
You must be signed in to change notification settings - Fork 191
Added helper scripts for platform package dependencies, build and install #5912
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/usr/bin/env bash | ||
| # build.sh runs autogen/configure and then builds CFEngine core | ||
| # the script should take into account the operating system environment and adjust, such as --without-pam on termux, BSDs and such | ||
| set -ex | ||
| thisdir="$(dirname "$0")" | ||
| cd "$thisdir"/.. | ||
| OPTS="--enable-debug" | ||
|
|
||
| if [ -n "$TERMUX_VERSION" ]; then | ||
| OPTS="$OPTS --without-pam" | ||
| fi | ||
|
|
||
| ./autogen.sh $OPTS | ||
| make |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||
| #!/usr/bin/env bash | ||||||||
| # dependencies.sh is called by install.sh to install libraries and packages needed to build and install CFEngine from source. | ||||||||
| set -ex | ||||||||
| # limited support here, focused on rhel-like on aarch64 which has no previous CFEngine version to leverage: ENT-13016 | ||||||||
| if [ -f /etc/os-release ]; then | ||||||||
| source /etc/os-release | ||||||||
| VERSION_MAJOR=${VERSION_ID%.*} | ||||||||
| if [ "$ID" = "rhel" ] || [[ "$ID_LIKE" =~ "rhel" ]]; then | ||||||||
| if [ "$VERSION_MAJOR" -ge "10" ]; then | ||||||||
| # note that having a redhat subscription makes things easier: lmdb-devel and librsync-devel are available from codeready-builder repo | ||||||||
| if subscription-manager status; then | ||||||||
| sudo subscription-manager config --rhsm.manage_repos=1 | ||||||||
| sudo subscription-manager repos --enable codeready-builder-for-rhel-"$VERSION_MAJOR"-"$(uname -m)"-rpms | ||||||||
| sudo dnf install --assumeyes https://dl.fedoraproject.org/pub/epel/epel-release-latest-"$VERSION_MAJOR".noarch.rpm | ||||||||
| sudo dnf install --assumeyes flex-devel lmdb-devel librsync-devel fakeroot # only available via subscription with codeready-builder installed | ||||||||
| # flex-devel, libyaml-devel and fakeroot are also only available easily from codeready-builder but are not critical to building CFEngine usable enough to configure a build host. | ||||||||
| # fakeroot is only needed for running tests but can be worked around by using GAINROOT=env with tests/acceptance/testall script | ||||||||
| else | ||||||||
| # here we assume no subscription and so must build those two dependencies from source :) | ||||||||
| sudo yum groups install -y 'Development Tools' | ||||||||
| sudo yum update --assumeyes | ||||||||
| sudo yum install -y gcc gdb make git libtool autoconf automake byacc flex openssl-devel pcre2-devel pam-devel libxml2-devel | ||||||||
| tmpdir="$(mktemp -d)" | ||||||||
| echo "Building lmdb and librsync in $tmpdir" | ||||||||
| ( | ||||||||
| cd "$tmpdir" | ||||||||
| git clone --recursive --depth 1 https://github.com/LMDB/lmdb | ||||||||
|
Comment on lines
+26
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could consider using the
Suggested change
|
||||||||
| cd lmdb/libraries/liblmdb | ||||||||
| make | ||||||||
| sudo make install prefix=/usr | ||||||||
|
Comment on lines
+28
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to do this in a subshell, so that you don't have to |
||||||||
| cd - | ||||||||
| sudo dnf install -y cmake | ||||||||
| git clone --recursive --depth 1 https://github.com/librsync/librsync | ||||||||
| cd librsync | ||||||||
| cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release . | ||||||||
| make | ||||||||
| sudo make install | ||||||||
| ) | ||||||||
| fi | ||||||||
| else | ||||||||
| echo "Unsupported version of redhat for $0" | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
| else | ||||||||
| echo "Unsupported distribution based on /etc/os-release." | ||||||||
| fi | ||||||||
| elif [ -n "$TERMUX_VERSION" ]; then | ||||||||
| pkg install build-essential git autoconf automake bison flex liblmdb openssl pcre2 libacl libyaml | ||||||||
| else | ||||||||
| echo "Unsupported operating system for $0" | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| # install.sh ensures dependencies are installed, builds core, then installs it | ||||||
| set -ex | ||||||
| thisdir=$(dirname $0) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| "$thisdir"/dependencies.sh | ||||||
| "$thisdir"/build.sh | ||||||
| cd "$thisdir"/.. | ||||||
| GAINROOT="" | ||||||
| if [ ! -n "$TERMUX_VERSION" ]; then | ||||||
| GAINROOT="sudo" | ||||||
| fi | ||||||
|
|
||||||
| $GAINROOT make install | ||||||
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.
No need to have double quotes around the string literals. But does not hurt