-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2175 from Ace-Tang/criu_test
test: install criu in ci test
- Loading branch information
Showing
5 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
source "./check.sh" | ||
|
||
# criu::ubuntu::install_dependencies will install dependencies packages. | ||
criu::ubuntu::install_dependencies() { | ||
apt-get install -y -q \ | ||
build-essential \ | ||
libnet1-dev \ | ||
libprotobuf-dev \ | ||
libprotobuf-c0-dev \ | ||
protobuf-c-compiler \ | ||
protobuf-compiler \ | ||
python-protobuf \ | ||
libnl-3-dev \ | ||
libcap-dev \ | ||
asciidoc | ||
} | ||
|
||
# criu::ubuntu::install will install criu from source. | ||
criu::ubuntu::install() { | ||
local tmpdir tag | ||
|
||
tag="v3.10" | ||
tmpdir="$(mktemp -d /tmp/criu-build-XXXXXX)" | ||
|
||
git clone https://github.com/checkpoint-restore/criu.git "${tmpdir}/criu" | ||
cd "${tmpdir}/criu" | ||
git checkout "${tag}" -b "${tag}" | ||
make | ||
make install | ||
} | ||
|
||
main() { | ||
local os_dist has_installed | ||
|
||
has_installed="$(command -v criu || echo false)" | ||
if [[ "${has_installed}" != "false" ]]; then | ||
echo "criu has been installed!" | ||
exit 0 | ||
fi | ||
|
||
echo ">>>> install criu <<<<" | ||
|
||
os_dist="$(detect_os)" | ||
if [[ "${os_dist}" = "Ubuntu" ]]; then | ||
criu::ubuntu::install_dependencies > /dev/null | ||
criu::ubuntu::install > /dev/null | ||
fi | ||
|
||
# final check | ||
command -v criu > /dev/null | ||
|
||
echo | ||
} | ||
|
||
main |
This file contains 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 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 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