mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 12:06:59 +00:00
[ubuntu] Refactor bash functions (#9055)
This commit is contained in:
committed by
GitHub
parent
d16bc5f120
commit
503ae89818
@@ -14,7 +14,7 @@ source $HELPER_SCRIPTS/etc-environment.sh
|
|||||||
# automatic installs. If you are using this front-end, and require
|
# automatic installs. If you are using this front-end, and require
|
||||||
# non-default answers to questions, you will need to preseed the
|
# non-default answers to questions, you will need to preseed the
|
||||||
# debconf database
|
# debconf database
|
||||||
setEtcEnvironmentVariable "DEBIAN_FRONTEND" "noninteractive"
|
set_etc_environment_variable "DEBIAN_FRONTEND" "noninteractive"
|
||||||
|
|
||||||
# dpkg can be instructed not to ask for confirmation
|
# dpkg can be instructed not to ask for confirmation
|
||||||
# when replacing a configuration file (with the --force-confdef --force-confold options)
|
# when replacing a configuration file (with the --force-confdef --force-confold options)
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ source $HELPER_SCRIPTS/os.sh
|
|||||||
source $HELPER_SCRIPTS/etc-environment.sh
|
source $HELPER_SCRIPTS/etc-environment.sh
|
||||||
|
|
||||||
# Set ImageVersion and ImageOS env variables
|
# Set ImageVersion and ImageOS env variables
|
||||||
setEtcEnvironmentVariable "ImageVersion" "${IMAGE_VERSION}"
|
set_etc_environment_variable "ImageVersion" "${IMAGE_VERSION}"
|
||||||
setEtcEnvironmentVariable "ImageOS" "${IMAGE_OS}"
|
set_etc_environment_variable "ImageOS" "${IMAGE_OS}"
|
||||||
|
|
||||||
# Set the ACCEPT_EULA variable to Y value to confirm your acceptance of the End-User Licensing Agreement
|
# Set the ACCEPT_EULA variable to Y value to confirm your acceptance of the End-User Licensing Agreement
|
||||||
setEtcEnvironmentVariable "ACCEPT_EULA" "Y"
|
set_etc_environment_variable "ACCEPT_EULA" "Y"
|
||||||
|
|
||||||
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/runner-images/issues/491)
|
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/runner-images/issues/491)
|
||||||
mkdir -p /etc/skel/.config/configstore
|
mkdir -p /etc/skel/.config/configstore
|
||||||
setEtcEnvironmentVariable "XDG_CONFIG_HOME" '$HOME/.config'
|
set_etc_environment_variable "XDG_CONFIG_HOME" '$HOME/.config'
|
||||||
|
|
||||||
# Change waagent entries to use /mnt for swapfile
|
# Change waagent entries to use /mnt for swapfile
|
||||||
sed -i 's/ResourceDisk.Format=n/ResourceDisk.Format=y/g' /etc/waagent.conf
|
sed -i 's/ResourceDisk.Format=n/ResourceDisk.Format=y/g' /etc/waagent.conf
|
||||||
@@ -30,7 +30,7 @@ sed -i 's/::1 ip6-localhost ip6-loopback/::1 localhost ip6-localhost ip6-loo
|
|||||||
# Prepare directory and env variable for toolcache
|
# Prepare directory and env variable for toolcache
|
||||||
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
|
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
|
||||||
mkdir $AGENT_TOOLSDIRECTORY
|
mkdir $AGENT_TOOLSDIRECTORY
|
||||||
setEtcEnvironmentVariable "AGENT_TOOLSDIRECTORY" "${AGENT_TOOLSDIRECTORY}"
|
set_etc_environment_variable "AGENT_TOOLSDIRECTORY" "${AGENT_TOOLSDIRECTORY}"
|
||||||
chmod -R 777 $AGENT_TOOLSDIRECTORY
|
chmod -R 777 $AGENT_TOOLSDIRECTORY
|
||||||
|
|
||||||
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
|
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
|
||||||
@@ -62,6 +62,6 @@ fi
|
|||||||
|
|
||||||
# Disable to load providers
|
# Disable to load providers
|
||||||
# https://github.com/microsoft/azure-pipelines-agent/issues/3834
|
# https://github.com/microsoft/azure-pipelines-agent/issues/3834
|
||||||
if isUbuntu22; then
|
if is_ubuntu22; then
|
||||||
sed -i 's/openssl_conf = openssl_init/#openssl_conf = openssl_init/g' /etc/ssl/openssl.cnf
|
sed -i 's/openssl_conf = openssl_init/#openssl_conf = openssl_init/g' /etc/ssl/openssl.cnf
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ source $HELPER_SCRIPTS/etc-environment.sh
|
|||||||
# Update /etc/environment to include /snap/bin in PATH
|
# Update /etc/environment to include /snap/bin in PATH
|
||||||
# because /etc/profile.d is ignored by `--norc` shell launch option
|
# because /etc/profile.d is ignored by `--norc` shell launch option
|
||||||
|
|
||||||
prependEtcEnvironmentPath "/snap/bin"
|
prepend_etc_environment_path "/snap/bin"
|
||||||
|
|
||||||
# Put snapd auto refresh on hold
|
# Put snapd auto refresh on hold
|
||||||
# as it may generate too much traffic on Canonical's snap server
|
# as it may generate too much traffic on Canonical's snap server
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ chmod 755 $IMAGE_FOLDER
|
|||||||
ENVPATH=$(grep 'PATH=' /etc/environment | head -n 1 | sed -z 's/^PATH=*//')
|
ENVPATH=$(grep 'PATH=' /etc/environment | head -n 1 | sed -z 's/^PATH=*//')
|
||||||
ENVPATH=${ENVPATH#"\""}
|
ENVPATH=${ENVPATH#"\""}
|
||||||
ENVPATH=${ENVPATH%"\""}
|
ENVPATH=${ENVPATH%"\""}
|
||||||
addEtcEnvironmentVariable "PATH" "${ENVPATH}"
|
add_etc_environment_variable "PATH" "${ENVPATH}"
|
||||||
echo "Updated /etc/environment: $(cat /etc/environment)"
|
echo "Updated /etc/environment: $(cat /etc/environment)"
|
||||||
|
|
||||||
# Сlean yarn and npm cache
|
# Сlean yarn and npm cache
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ ACTION_ARCHIVE_CACHE_DIR=/opt/actionarchivecache
|
|||||||
mkdir -p $ACTION_ARCHIVE_CACHE_DIR
|
mkdir -p $ACTION_ARCHIVE_CACHE_DIR
|
||||||
chmod -R 777 $ACTION_ARCHIVE_CACHE_DIR
|
chmod -R 777 $ACTION_ARCHIVE_CACHE_DIR
|
||||||
echo "Setting up ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE variable to ${ACTION_ARCHIVE_CACHE_DIR}"
|
echo "Setting up ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE variable to ${ACTION_ARCHIVE_CACHE_DIR}"
|
||||||
setEtcEnvironmentVariable "ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE" "${ACTION_ARCHIVE_CACHE_DIR}"
|
set_etc_environment_variable "ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE" "${ACTION_ARCHIVE_CACHE_DIR}"
|
||||||
|
|
||||||
# Download latest release from github.com/actions/action-versions and untar to /opt/actionarchivecache
|
# Download latest release from github.com/actions/action-versions and untar to /opt/actionarchivecache
|
||||||
downloadUrl=$(resolve_github_release_asset_url "actions/action-versions" "endswith(\"action-versions.tar.gz\")" "latest")
|
downloadUrl=$(resolve_github_release_asset_url "actions/action-versions" "endswith(\"action-versions.tar.gz\")" "latest")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ source $HELPER_SCRIPTS/install.sh
|
|||||||
|
|
||||||
# Install Alibaba Cloud CLI
|
# Install Alibaba Cloud CLI
|
||||||
# Pin tool version on ubuntu20 due to issues with GLIBC_2.32 not available
|
# Pin tool version on ubuntu20 due to issues with GLIBC_2.32 not available
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
toolset_version=$(get_toolset_value '.aliyunCli.version')
|
toolset_version=$(get_toolset_value '.aliyunCli.version')
|
||||||
download_url="https://github.com/aliyun/aliyun-cli/releases/download/v$toolset_version/aliyun-cli-linux-$toolset_version-amd64.tgz"
|
download_url="https://github.com/aliyun/aliyun-cli/releases/download/v$toolset_version/aliyun-cli-linux-$toolset_version-amd64.tgz"
|
||||||
else
|
else
|
||||||
@@ -22,7 +22,7 @@ fi
|
|||||||
archive_path=$(download_with_retry "$download_url")
|
archive_path=$(download_with_retry "$download_url")
|
||||||
|
|
||||||
# Supply chain security - Alibaba Cloud CLI
|
# Supply chain security - Alibaba Cloud CLI
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
external_hash=$(get_toolset_value '.aliyunCli.sha256')
|
external_hash=$(get_toolset_value '.aliyunCli.sha256')
|
||||||
else
|
else
|
||||||
external_hash=$(get_checksum_from_url "$hash_url" "aliyun-cli-linux.*amd64.tgz" "SHA256")
|
external_hash=$(get_checksum_from_url "$hash_url" "aliyun-cli-linux.*amd64.tgz" "SHA256")
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ get_full_ndk_version() {
|
|||||||
ANDROID_ROOT=/usr/local/lib/android
|
ANDROID_ROOT=/usr/local/lib/android
|
||||||
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
|
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
|
||||||
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
|
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
|
||||||
setEtcEnvironmentVariable "ANDROID_SDK_ROOT" "${ANDROID_SDK_ROOT}"
|
set_etc_environment_variable "ANDROID_SDK_ROOT" "${ANDROID_SDK_ROOT}"
|
||||||
|
|
||||||
# ANDROID_HOME is deprecated, but older versions of Gradle rely on it
|
# ANDROID_HOME is deprecated, but older versions of Gradle rely on it
|
||||||
setEtcEnvironmentVariable "ANDROID_HOME" "${ANDROID_SDK_ROOT}"
|
set_etc_environment_variable "ANDROID_HOME" "${ANDROID_SDK_ROOT}"
|
||||||
|
|
||||||
# Create android sdk directory
|
# Create android sdk directory
|
||||||
mkdir -p ${ANDROID_SDK_ROOT}
|
mkdir -p ${ANDROID_SDK_ROOT}
|
||||||
@@ -87,10 +87,10 @@ ndk_default_full_version=$(get_full_ndk_version $android_ndk_major_default)
|
|||||||
ndk_latest_full_version=$(get_full_ndk_version $android_ndk_major_latest)
|
ndk_latest_full_version=$(get_full_ndk_version $android_ndk_major_latest)
|
||||||
ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${ndk_default_full_version}
|
ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${ndk_default_full_version}
|
||||||
# ANDROID_NDK, ANDROID_NDK_HOME, and ANDROID_NDK_ROOT variables should be set as many customer builds depend on them https://github.com/actions/runner-images/issues/5879
|
# ANDROID_NDK, ANDROID_NDK_HOME, and ANDROID_NDK_ROOT variables should be set as many customer builds depend on them https://github.com/actions/runner-images/issues/5879
|
||||||
setEtcEnvironmentVariable "ANDROID_NDK" "${ANDROID_NDK}"
|
set_etc_environment_variable "ANDROID_NDK" "${ANDROID_NDK}"
|
||||||
setEtcEnvironmentVariable "ANDROID_NDK_HOME" "${ANDROID_NDK}"
|
set_etc_environment_variable "ANDROID_NDK_HOME" "${ANDROID_NDK}"
|
||||||
setEtcEnvironmentVariable "ANDROID_NDK_ROOT" "${ANDROID_NDK}"
|
set_etc_environment_variable "ANDROID_NDK_ROOT" "${ANDROID_NDK}"
|
||||||
setEtcEnvironmentVariable "ANDROID_NDK_LATEST_HOME" "${ANDROID_SDK_ROOT}/ndk/${ndk_latest_full_version}"
|
set_etc_environment_variable "ANDROID_NDK_LATEST_HOME" "${ANDROID_SDK_ROOT}/ndk/${ndk_latest_full_version}"
|
||||||
|
|
||||||
# Prepare components for installation
|
# Prepare components for installation
|
||||||
extras=$(get_toolset_value '.android.extra_list[] | "extras;" + .')
|
extras=$(get_toolset_value '.android.extra_list[] | "extras;" + .')
|
||||||
@@ -119,6 +119,6 @@ sed -i "2i export JAVA_HOME=${JAVA_HOME_8_X64}" ${ANDROID_SDK_ROOT}/tools/bin/sd
|
|||||||
# Add required permissions
|
# Add required permissions
|
||||||
chmod -R a+rwx ${ANDROID_SDK_ROOT}
|
chmod -R a+rwx ${ANDROID_SDK_ROOT}
|
||||||
|
|
||||||
reloadEtcEnvironment
|
reload_etc_environment
|
||||||
|
|
||||||
invoke_tests "Android"
|
invoke_tests "Android"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ source $HELPER_SCRIPTS/etc-environment.sh
|
|||||||
# AZURE_EXTENSION_DIR shell variable defines where modules are installed
|
# AZURE_EXTENSION_DIR shell variable defines where modules are installed
|
||||||
# https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
|
# https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
|
||||||
export AZURE_EXTENSION_DIR=/opt/az/azcliextensions
|
export AZURE_EXTENSION_DIR=/opt/az/azcliextensions
|
||||||
setEtcEnvironmentVariable "AZURE_EXTENSION_DIR" "${AZURE_EXTENSION_DIR}"
|
set_etc_environment_variable "AZURE_EXTENSION_DIR" "${AZURE_EXTENSION_DIR}"
|
||||||
|
|
||||||
# install azure devops Cli extension
|
# install azure devops Cli extension
|
||||||
az extension add -n azure-devops
|
az extension add -n azure-devops
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
function InstallClang {
|
install_clang() {
|
||||||
local version=$1
|
local version=$1
|
||||||
|
|
||||||
echo "Installing clang-$version..."
|
echo "Installing clang-$version..."
|
||||||
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version" "clang-tidy-$version"
|
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version" "clang-tidy-$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetDefaultClang {
|
set_default_clang() {
|
||||||
local version=$1
|
local version=$1
|
||||||
|
|
||||||
echo "Make Clang ${version} default"
|
echo "Make Clang ${version} default"
|
||||||
@@ -30,11 +30,11 @@ default_clang_version=$(get_toolset_value '.clang.default_version')
|
|||||||
|
|
||||||
for version in ${versions[*]}; do
|
for version in ${versions[*]}; do
|
||||||
if [[ $version != $default_clang_version ]]; then
|
if [[ $version != $default_clang_version ]]; then
|
||||||
InstallClang $version
|
install_clang $version
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
InstallClang $default_clang_version
|
install_clang $default_clang_version
|
||||||
SetDefaultClang $default_clang_version
|
set_default_clang $default_clang_version
|
||||||
|
|
||||||
invoke_tests "Tools" "clang"
|
invoke_tests "Tools" "clang"
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ source $HELPER_SCRIPTS/os.sh
|
|||||||
# pin podman due to https://github.com/actions/runner-images/issues/7753
|
# pin podman due to https://github.com/actions/runner-images/issues/7753
|
||||||
# https://bugs.launchpad.net/ubuntu/+source/libpod/+bug/2024394
|
# https://bugs.launchpad.net/ubuntu/+source/libpod/+bug/2024394
|
||||||
#
|
#
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
install_packages=(podman buildah skopeo)
|
install_packages=(podman buildah skopeo)
|
||||||
else
|
else
|
||||||
install_packages=(podman=3.4.4+ds1-1ubuntu1 buildah skopeo)
|
install_packages=(podman=3.4.4+ds1-1ubuntu1 buildah skopeo)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Packages is available in the official Ubuntu upstream starting from Ubuntu 21
|
# Packages is available in the official Ubuntu upstream starting from Ubuntu 21
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable"
|
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable"
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
sh -c "echo 'deb ${REPO_URL}/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
|
sh -c "echo 'deb ${REPO_URL}/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
|
||||||
@@ -31,7 +31,7 @@ apt-get -y install ${install_packages[@]}
|
|||||||
mkdir -p /etc/containers
|
mkdir -p /etc/containers
|
||||||
printf "[registries.search]\nregistries = ['docker.io', 'quay.io']\n" | tee /etc/containers/registries.conf
|
printf "[registries.search]\nregistries = ['docker.io', 'quay.io']\n" | tee /etc/containers/registries.conf
|
||||||
|
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
# Remove source repo
|
# Remove source repo
|
||||||
rm /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
rm /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
||||||
# Document source repo
|
# Document source repo
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ gpg_key="/usr/share/keyrings/docker.gpg"
|
|||||||
repo_path="/etc/apt/sources.list.d/docker.list"
|
repo_path="/etc/apt/sources.list.d/docker.list"
|
||||||
|
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o $gpg_key
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o $gpg_key
|
||||||
echo "deb [arch=amd64 signed-by=$gpg_key] $repo_url $(getOSVersionLabel) stable" > $repo_path
|
echo "deb [arch=amd64 signed-by=$gpg_key] $repo_url $(get_os_version_label) stable" > $repo_path
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin
|
apt-get install --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ apt-get update
|
|||||||
|
|
||||||
for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do
|
for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do
|
||||||
echo "Determing if .NET Core ($latest_package) is installed"
|
echo "Determing if .NET Core ($latest_package) is installed"
|
||||||
if ! IsPackageInstalled $latest_package; then
|
if ! dpkg -S $latest_package &> /dev/null; then
|
||||||
echo "Could not find .NET Core ($latest_package), installing..."
|
echo "Could not find .NET Core ($latest_package), installing..."
|
||||||
apt-get install $latest_package -y
|
apt-get install $latest_package -y
|
||||||
else
|
else
|
||||||
@@ -82,10 +82,10 @@ find . -name "*.tar.gz" | parallel --halt soon,fail=1 'extract_dotnet_sdk {}'
|
|||||||
|
|
||||||
# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test
|
# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test
|
||||||
# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine
|
# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine
|
||||||
setEtcEnvironmentVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
|
set_etc_environment_variable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
|
||||||
setEtcEnvironmentVariable DOTNET_NOLOGO 1
|
set_etc_environment_variable DOTNET_NOLOGO 1
|
||||||
setEtcEnvironmentVariable DOTNET_MULTILEVEL_LOOKUP 0
|
set_etc_environment_variable DOTNET_MULTILEVEL_LOOKUP 0
|
||||||
prependEtcEnvironmentPath '$HOME/.dotnet/tools'
|
prepend_etc_environment_path '$HOME/.dotnet/tools'
|
||||||
|
|
||||||
# install dotnet tools
|
# install dotnet tools
|
||||||
for dotnet_tool in ${DOTNET_TOOLS[@]}; do
|
for dotnet_tool in ${DOTNET_TOOLS[@]}; do
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ repo_path="/etc/apt/sources.list.d/mozillateam-ubuntu-ppa-focal.list"
|
|||||||
|
|
||||||
# Install Firefox
|
# Install Firefox
|
||||||
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${gpg_fingerprint}" | sudo gpg --dearmor -o $gpg_key
|
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${gpg_fingerprint}" | sudo gpg --dearmor -o $gpg_key
|
||||||
echo "deb $repo_url $(getOSVersionLabel) main" > $repo_path
|
echo "deb $repo_url $(get_os_version_label) main" > $repo_path
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install --target-release 'o=LP-PPA-mozillateam' -y firefox
|
apt-get install --target-release 'o=LP-PPA-mozillateam' -y firefox
|
||||||
@@ -44,6 +44,6 @@ tar -xzf "$driver_archive_path" -C $GECKODRIVER_DIR
|
|||||||
|
|
||||||
chmod +x $GECKODRIVER_BIN
|
chmod +x $GECKODRIVER_BIN
|
||||||
ln -s "$GECKODRIVER_BIN" /usr/bin/
|
ln -s "$GECKODRIVER_BIN" /usr/bin/
|
||||||
setEtcEnvironmentVariable "GECKOWEBDRIVER" "${GECKODRIVER_DIR}"
|
set_etc_environment_variable "GECKOWEBDRIVER" "${GECKODRIVER_DIR}"
|
||||||
|
|
||||||
invoke_tests "Browsers" "Firefox"
|
invoke_tests "Browsers" "Firefox"
|
||||||
|
|||||||
@@ -8,13 +8,6 @@
|
|||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
function InstallGcc {
|
|
||||||
version=$1
|
|
||||||
|
|
||||||
echo "Installing $version..."
|
|
||||||
apt-get install $version -y
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install GNU C++ compiler
|
# Install GNU C++ compiler
|
||||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
@@ -22,7 +15,8 @@ apt-get update -y
|
|||||||
versions=$(get_toolset_value '.gcc.versions[]')
|
versions=$(get_toolset_value '.gcc.versions[]')
|
||||||
|
|
||||||
for version in ${versions[*]}; do
|
for version in ${versions[*]}; do
|
||||||
InstallGcc $version
|
echo "Installing $version..."
|
||||||
|
apt-get install $version -y
|
||||||
done
|
done
|
||||||
|
|
||||||
invoke_tests "Tools" "gcc"
|
invoke_tests "Tools" "gcc"
|
||||||
|
|||||||
@@ -6,22 +6,15 @@
|
|||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
function InstallFortran {
|
|
||||||
version=$1
|
|
||||||
|
|
||||||
echo "Installing $version..."
|
|
||||||
apt-get install $version -y
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install GNU Fortran compiler
|
# Install GNU Fortran compiler
|
||||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
versions=$(get_toolset_value '.gfortran.versions[]')
|
versions=$(get_toolset_value '.gfortran.versions[]')
|
||||||
|
|
||||||
for version in ${versions[*]}
|
for version in ${versions[*]}; do
|
||||||
do
|
echo "Installing $version..."
|
||||||
InstallFortran $version
|
apt-get install $version -y
|
||||||
done
|
done
|
||||||
|
|
||||||
invoke_tests "Tools" "gfortran"
|
invoke_tests "Tools" "gfortran"
|
||||||
|
|||||||
@@ -8,35 +8,37 @@
|
|||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
source $HELPER_SCRIPTS/etc-environment.sh
|
source $HELPER_SCRIPTS/etc-environment.sh
|
||||||
|
|
||||||
function GetChromiumRevision {
|
get_chromium_revision() {
|
||||||
CHROME_REVISION=$1
|
local chrome_revision=$1
|
||||||
|
|
||||||
# Take the first part of the revision variable to search not only for a specific version,
|
# Take the first part of the revision variable to search not only for a specific version,
|
||||||
# but also for similar ones, so that we can get a previous one if the required revision is not found
|
# but also for similar ones, so that we can get a previous one if the required revision is not found
|
||||||
CHROME_REVISION_PREFIX=${CHROME_REVISION:0:${#CHROME_REVISION}/2+1}
|
chrome_revision_prefix=${chrome_revision:0:${#chrome_revision}/2+1}
|
||||||
SEARCH_URL="https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o?delimiter=/&prefix=Linux_x64"
|
SEARCH_URL="https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o?delimiter=/&prefix=Linux_x64"
|
||||||
# Revision can include a hash instead of a number. Need to filter it out https://github.com/actions/runner-images/issues/5256
|
# Revision can include a hash instead of a number. Need to filter it out https://github.com/actions/runner-images/issues/5256
|
||||||
REVISIONS_AVAILABLE=$(curl -s $SEARCH_URL/${CHROME_REVISION_PREFIX} | jq -r '.prefixes[]' | grep -E "Linux_x64\/[0-9]+\/"| cut -d "/" -f 2 | sort --version-sort)
|
revisions_available=$(curl -s $SEARCH_URL/${chrome_revision_prefix} | jq -r '.prefixes[]' | grep -E "Linux_x64\/[0-9]+\/"| cut -d "/" -f 2 | sort --version-sort)
|
||||||
|
|
||||||
# If required Chromium revision is not found in the list
|
# If required Chromium revision is not found in the list
|
||||||
# we should have to decrement the revision number until we find one.
|
# we should have to decrement the revision number until we find one.
|
||||||
# This is mentioned in the documentation we use for this installation:
|
# This is mentioned in the documentation we use for this installation:
|
||||||
# https://www.chromium.org/getting-involved/download-chromium
|
# https://www.chromium.org/getting-involved/download-chromium
|
||||||
LATEST_VALID_REVISION=$(echo $REVISIONS_AVAILABLE | cut -f 1 -d " ")
|
latest_valid_revision=$(echo $revisions_available | cut -f 1 -d " ")
|
||||||
for REVISION in $REVISIONS_AVAILABLE; do
|
for revision in $revisions_available; do
|
||||||
if [ "$CHROME_REVISION" -lt "$REVISION" ]; then
|
if [ "$chrome_revision" -lt "$revision" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
LATEST_VALID_REVISION=$REVISION
|
|
||||||
|
latest_valid_revision=$revision
|
||||||
done
|
done
|
||||||
echo $LATEST_VALID_REVISION
|
|
||||||
|
echo $latest_valid_revision
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download and install Google Chrome
|
# Download and install Google Chrome
|
||||||
CHROME_DEB_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
|
CHROME_DEB_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
|
||||||
CHROME_DEB_PATH=$(download_with_retry "$CHROME_DEB_URL")
|
CHROME_DEB_PATH=$(download_with_retry "$CHROME_DEB_URL")
|
||||||
apt install "$CHROME_DEB_PATH" -f
|
apt install "$CHROME_DEB_PATH" -f
|
||||||
setEtcEnvironmentVariable "CHROME_BIN" "/usr/bin/google-chrome"
|
set_etc_environment_variable "CHROME_BIN" "/usr/bin/google-chrome"
|
||||||
|
|
||||||
# Remove Google Chrome repo
|
# Remove Google Chrome repo
|
||||||
rm -f /etc/cron.daily/google-chrome /etc/apt/sources.list.d/google-chrome.list /etc/apt/sources.list.d/google-chrome.list.save
|
rm -f /etc/cron.daily/google-chrome /etc/apt/sources.list.d/google-chrome.list /etc/apt/sources.list.d/google-chrome.list.save
|
||||||
@@ -63,11 +65,11 @@ unzip -qq "$driver_archive_path" -d /usr/local/share
|
|||||||
|
|
||||||
chmod +x $CHROMEDRIVER_BIN
|
chmod +x $CHROMEDRIVER_BIN
|
||||||
ln -s "$CHROMEDRIVER_BIN" /usr/bin/
|
ln -s "$CHROMEDRIVER_BIN" /usr/bin/
|
||||||
setEtcEnvironmentVariable "CHROMEWEBDRIVER" "${CHROMEDRIVER_DIR}"
|
set_etc_environment_variable "CHROMEWEBDRIVER" "${CHROMEDRIVER_DIR}"
|
||||||
|
|
||||||
# Download and unpack Chromium
|
# Download and unpack Chromium
|
||||||
CHROME_REVISION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].revision')
|
CHROME_REVISION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].revision')
|
||||||
CHROMIUM_REVISION=$(GetChromiumRevision $CHROME_REVISION)
|
CHROMIUM_REVISION=$(get_chromium_revision $CHROME_REVISION)
|
||||||
CHROMIUM_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${CHROMIUM_REVISION}%2Fchrome-linux.zip?alt=media"
|
CHROMIUM_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${CHROMIUM_REVISION}%2Fchrome-linux.zip?alt=media"
|
||||||
CHROMIUM_DIR="/usr/local/share/chromium"
|
CHROMIUM_DIR="/usr/local/share/chromium"
|
||||||
CHROMIUM_BIN="${CHROMIUM_DIR}/chrome-linux/chrome"
|
CHROMIUM_BIN="${CHROMIUM_DIR}/chrome-linux/chrome"
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ export BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1
|
|||||||
export GHCUP_INSTALL_BASE_PREFIX=/usr/local
|
export GHCUP_INSTALL_BASE_PREFIX=/usr/local
|
||||||
export BOOTSTRAP_HASKELL_GHC_VERSION=0
|
export BOOTSTRAP_HASKELL_GHC_VERSION=0
|
||||||
ghcup_bin=$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin
|
ghcup_bin=$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin
|
||||||
setEtcEnvironmentVariable "BOOTSTRAP_HASKELL_NONINTERACTIVE" $BOOTSTRAP_HASKELL_NONINTERACTIVE
|
set_etc_environment_variable "BOOTSTRAP_HASKELL_NONINTERACTIVE" $BOOTSTRAP_HASKELL_NONINTERACTIVE
|
||||||
setEtcEnvironmentVariable "GHCUP_INSTALL_BASE_PREFIX" $GHCUP_INSTALL_BASE_PREFIX
|
set_etc_environment_variable "GHCUP_INSTALL_BASE_PREFIX" $GHCUP_INSTALL_BASE_PREFIX
|
||||||
|
|
||||||
# Install GHCup
|
# Install GHCup
|
||||||
curl --proto '=https' --tlsv1.2 -fsSL https://get-ghcup.haskell.org | sh > /dev/null 2>&1 || true
|
curl --proto '=https' --tlsv1.2 -fsSL https://get-ghcup.haskell.org | sh > /dev/null 2>&1 || true
|
||||||
export PATH="$ghcup_bin:$PATH"
|
export PATH="$ghcup_bin:$PATH"
|
||||||
prependEtcEnvironmentPath $ghcup_bin
|
prepend_etc_environment_path $ghcup_bin
|
||||||
|
|
||||||
availableVersions=$(ghcup list -t ghc -r | grep -v "prerelease" | awk '{print $2}')
|
availableVersions=$(ghcup list -t ghc -r | grep -v "prerelease" | awk '{print $2}')
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ source $HELPER_SCRIPTS/install.sh
|
|||||||
# Invoke shellenv to make brew available during runnig session
|
# Invoke shellenv to make brew available during runnig session
|
||||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||||
|
|
||||||
setEtcEnvironmentVariable HOMEBREW_NO_AUTO_UPDATE 1
|
set_etc_environment_variable HOMEBREW_NO_AUTO_UPDATE 1
|
||||||
setEtcEnvironmentVariable HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS 3650
|
set_etc_environment_variable HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS 3650
|
||||||
|
|
||||||
# Validate the installation ad hoc
|
# Validate the installation ad hoc
|
||||||
echo "Validate the installation reloading /etc/environment"
|
echo "Validate the installation reloading /etc/environment"
|
||||||
reloadEtcEnvironment
|
reload_etc_environment
|
||||||
|
|
||||||
gfortran=$(brew --prefix)/bin/gfortran
|
gfortran=$(brew --prefix)/bin/gfortran
|
||||||
# Remove gfortran symlink, not to conflict with system gfortran
|
# Remove gfortran symlink, not to conflict with system gfortran
|
||||||
|
|||||||
@@ -8,71 +8,63 @@ source $HELPER_SCRIPTS/install.sh
|
|||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
source $HELPER_SCRIPTS/etc-environment.sh
|
source $HELPER_SCRIPTS/etc-environment.sh
|
||||||
|
|
||||||
createJavaEnvironmentalVariable() {
|
create_java_environment_variable() {
|
||||||
local JAVA_VERSION=$1
|
local java_version=$1
|
||||||
local DEFAULT=$2
|
local default=$2
|
||||||
|
|
||||||
local INSTALL_PATH_PATTERN="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64"
|
local install_path_pattern="/usr/lib/jvm/temurin-${java_version}-jdk-amd64"
|
||||||
|
|
||||||
if [[ ${DEFAULT} == "True" ]]; then
|
if [[ ${default} == "True" ]]; then
|
||||||
echo "Setting up JAVA_HOME variable to ${INSTALL_PATH_PATTERN}"
|
echo "Setting up JAVA_HOME variable to ${install_path_pattern}"
|
||||||
setEtcEnvironmentVariable "JAVA_HOME" "${INSTALL_PATH_PATTERN}"
|
set_etc_environment_variable "JAVA_HOME" "${install_path_pattern}"
|
||||||
echo "Setting up default symlink"
|
echo "Setting up default symlink"
|
||||||
update-java-alternatives -s ${INSTALL_PATH_PATTERN}
|
update-java-alternatives -s ${install_path_pattern}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting up JAVA_HOME_${JAVA_VERSION}_X64 variable to ${INSTALL_PATH_PATTERN}"
|
echo "Setting up JAVA_HOME_${java_version}_X64 variable to ${install_path_pattern}"
|
||||||
setEtcEnvironmentVariable "JAVA_HOME_${JAVA_VERSION}_X64" "${INSTALL_PATH_PATTERN}"
|
set_etc_environment_variable "JAVA_HOME_${java_version}_X64" "${install_path_pattern}"
|
||||||
}
|
}
|
||||||
|
|
||||||
enableRepositories() {
|
install_open_jdk() {
|
||||||
osLabel=$(getOSVersionLabel)
|
local java_version=$1
|
||||||
|
|
||||||
# Add Addoptium PPA
|
|
||||||
# apt-key is deprecated, dearmor and add manually
|
|
||||||
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor > /usr/share/keyrings/adoptium.gpg
|
|
||||||
echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb/ $osLabel main" > /etc/apt/sources.list.d/adoptium.list
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
installOpenJDK() {
|
|
||||||
local JAVA_VERSION=$1
|
|
||||||
|
|
||||||
# Install Java from PPA repositories.
|
# Install Java from PPA repositories.
|
||||||
apt-get -y install temurin-${JAVA_VERSION}-jdk=\*
|
apt-get -y install temurin-${java_version}-jdk=\*
|
||||||
javaVersionPath="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64"
|
java_version_path="/usr/lib/jvm/temurin-${java_version}-jdk-amd64"
|
||||||
|
|
||||||
JAVA_TOOLCACHE_PATH="${AGENT_TOOLSDIRECTORY}/Java_Temurin-Hotspot_jdk"
|
java_toolcache_path="${AGENT_TOOLSDIRECTORY}/Java_Temurin-Hotspot_jdk"
|
||||||
|
|
||||||
fullJavaVersion=$(cat "${javaVersionPath}/release" | grep "^SEMANTIC" | cut -d "=" -f 2 | tr -d "\"" | tr "+" "-")
|
full_java_version=$(cat "${java_version_path}/release" | grep "^SEMANTIC" | cut -d "=" -f 2 | tr -d "\"" | tr "+" "-")
|
||||||
|
|
||||||
# If there is no semver in java release, then extract java version from -fullversion
|
# If there is no semver in java release, then extract java version from -fullversion
|
||||||
[[ -z ${fullJavaVersion} ]] && fullJavaVersion=$(${javaVersionPath}/bin/java -fullversion 2>&1 | tr -d "\"" | tr "+" "-" | awk '{print $4}')
|
[[ -z ${full_java_version} ]] && full_java_version=$(${java_version_path}/bin/java -fullversion 2>&1 | tr -d "\"" | tr "+" "-" | awk '{print $4}')
|
||||||
|
|
||||||
# Convert non valid semver like 11.0.14.1-9 -> 11.0.14-9
|
# Convert non valid semver like 11.0.14.1-9 -> 11.0.14-9
|
||||||
# https://github.com/adoptium/temurin-build/issues/2248
|
# https://github.com/adoptium/temurin-build/issues/2248
|
||||||
[[ ${fullJavaVersion} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]] && fullJavaVersion=$(echo $fullJavaVersion | sed -E 's/\.[0-9]+-/-/')
|
[[ ${full_java_version} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]] && full_java_version=$(echo $full_java_version | sed -E 's/\.[0-9]+-/-/')
|
||||||
|
|
||||||
# When version string is too short, add extra ".0" to make it valid semver
|
# When version string is too short, add extra ".0" to make it valid semver
|
||||||
[[ ${fullJavaVersion} =~ ^[0-9]+- ]] && fullJavaVersion=$(echo $fullJavaVersion | sed -E 's/-/.0-/')
|
[[ ${full_java_version} =~ ^[0-9]+- ]] && full_java_version=$(echo $full_java_version | sed -E 's/-/.0-/')
|
||||||
[[ ${fullJavaVersion} =~ ^[0-9]+\.[0-9]+- ]] && fullJavaVersion=$(echo $fullJavaVersion | sed -E 's/-/.0-/')
|
[[ ${full_java_version} =~ ^[0-9]+\.[0-9]+- ]] && full_java_version=$(echo $full_java_version | sed -E 's/-/.0-/')
|
||||||
|
|
||||||
javaToolcacheVersionPath="${JAVA_TOOLCACHE_PATH}/${fullJavaVersion}"
|
java_toolcache_version_path="${java_toolcache_path}/${full_java_version}"
|
||||||
echo "Java ${JAVA_VERSION} Toolcache Version Path: ${javaToolcacheVersionPath}"
|
echo "Java ${java_version} Toolcache Version Path: ${java_toolcache_version_path}"
|
||||||
mkdir -p "${javaToolcacheVersionPath}"
|
mkdir -p "${java_toolcache_version_path}"
|
||||||
|
|
||||||
# Create a complete file
|
# Create a complete file
|
||||||
touch "${javaToolcacheVersionPath}/x64.complete"
|
touch "${java_toolcache_version_path}/x64.complete"
|
||||||
|
|
||||||
# Create symlink for Java
|
# Create symlink for Java
|
||||||
ln -s ${javaVersionPath} "${javaToolcacheVersionPath}/x64"
|
ln -s ${java_version_path} "${java_toolcache_version_path}/x64"
|
||||||
|
|
||||||
# add extra permissions to be able execute command without sudo
|
# add extra permissions to be able execute command without sudo
|
||||||
chmod -R 777 /usr/lib/jvm
|
chmod -R 777 /usr/lib/jvm
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fetch repositories data
|
# Add Addoptium PPA
|
||||||
enableRepositories
|
# apt-key is deprecated, dearmor and add manually
|
||||||
|
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor > /usr/share/keyrings/adoptium.gpg
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb/ $(get_os_version_label) main" > /etc/apt/sources.list.d/adoptium.list
|
||||||
|
|
||||||
# Get all the updates from enabled repositories.
|
# Get all the updates from enabled repositories.
|
||||||
apt-get update
|
apt-get update
|
||||||
@@ -81,19 +73,19 @@ defaultVersion=$(get_toolset_value '.java.default')
|
|||||||
jdkVersionsToInstall=($(get_toolset_value ".java.versions[]"))
|
jdkVersionsToInstall=($(get_toolset_value ".java.versions[]"))
|
||||||
|
|
||||||
for jdkVersionToInstall in ${jdkVersionsToInstall[@]}; do
|
for jdkVersionToInstall in ${jdkVersionsToInstall[@]}; do
|
||||||
installOpenJDK ${jdkVersionToInstall}
|
install_open_jdk ${jdkVersionToInstall}
|
||||||
|
|
||||||
if [[ ${jdkVersionToInstall} == ${defaultVersion} ]]
|
if [[ ${jdkVersionToInstall} == ${defaultVersion} ]]
|
||||||
then
|
then
|
||||||
createJavaEnvironmentalVariable ${jdkVersionToInstall} True
|
create_java_environment_variable ${jdkVersionToInstall} True
|
||||||
else
|
else
|
||||||
createJavaEnvironmentalVariable ${jdkVersionToInstall} False
|
create_java_environment_variable ${jdkVersionToInstall} False
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Install Ant
|
# Install Ant
|
||||||
apt-get install -y --no-install-recommends ant ant-optional
|
apt-get install -y --no-install-recommends ant ant-optional
|
||||||
setEtcEnvironmentVariable "ANT_HOME" "/usr/share/ant"
|
set_etc_environment_variable "ANT_HOME" "/usr/share/ant"
|
||||||
|
|
||||||
# Install Maven
|
# Install Maven
|
||||||
mavenVersion=$(get_toolset_value '.java.maven')
|
mavenVersion=$(get_toolset_value '.java.maven')
|
||||||
@@ -114,7 +106,7 @@ gradle_archive_path=$(download_with_retry "$gradleDownloadUrl")
|
|||||||
unzip -qq -d /usr/share "$gradle_archive_path"
|
unzip -qq -d /usr/share "$gradle_archive_path"
|
||||||
ln -s /usr/share/gradle-"${gradleLatestVersion}"/bin/gradle /usr/bin/gradle
|
ln -s /usr/share/gradle-"${gradleLatestVersion}"/bin/gradle /usr/bin/gradle
|
||||||
gradle_home_dir=$(find /usr/share -depth -maxdepth 1 -name "gradle*")
|
gradle_home_dir=$(find /usr/share -depth -maxdepth 1 -name "gradle*")
|
||||||
setEtcEnvironmentVariable "GRADLE_HOME" "${gradle_home_dir}"
|
set_etc_environment_variable "GRADLE_HOME" "${gradle_home_dir}"
|
||||||
|
|
||||||
# Delete java repositories and keys
|
# Delete java repositories and keys
|
||||||
rm -f /etc/apt/sources.list.d/adoptium.list
|
rm -f /etc/apt/sources.list.d/adoptium.list
|
||||||
@@ -122,5 +114,5 @@ rm -f /etc/apt/sources.list.d/zulu.list
|
|||||||
rm -f /usr/share/keyrings/adoptium.gpg
|
rm -f /usr/share/keyrings/adoptium.gpg
|
||||||
rm -f /usr/share/keyrings/zulu.gpg
|
rm -f /usr/share/keyrings/zulu.gpg
|
||||||
|
|
||||||
reloadEtcEnvironment
|
reload_etc_environment
|
||||||
invoke_tests "Java"
|
invoke_tests "Java"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export LEIN_HOME=/usr/local/lib/lein
|
|||||||
lein
|
lein
|
||||||
|
|
||||||
LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar")
|
LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar")
|
||||||
setEtcEnvironmentVariable "LEIN_JAR" "${LEIN_JAR}"
|
set_etc_environment_variable "LEIN_JAR" "${LEIN_JAR}"
|
||||||
setEtcEnvironmentVariable "LEIN_HOME" "${LEIN_HOME}"
|
set_etc_environment_variable "LEIN_HOME" "${LEIN_HOME}"
|
||||||
|
|
||||||
invoke_tests "Tools" "Leiningen"
|
invoke_tests "Tools" "Leiningen"
|
||||||
|
|||||||
@@ -46,6 +46,6 @@ unzip -qq "$EDGEDRIVER_ARCHIVE_PATH" -d "$EDGEDRIVER_DIR"
|
|||||||
chmod +x $EDGEDRIVER_BIN
|
chmod +x $EDGEDRIVER_BIN
|
||||||
ln -s $EDGEDRIVER_BIN /usr/bin
|
ln -s $EDGEDRIVER_BIN /usr/bin
|
||||||
|
|
||||||
setEtcEnvironmentVariable "EDGEWEBDRIVER" "${EDGEDRIVER_DIR}"
|
set_etc_environment_variable "EDGEWEBDRIVER" "${EDGEDRIVER_DIR}"
|
||||||
|
|
||||||
invoke_tests "Browsers" "Edge"
|
invoke_tests "Browsers" "Edge"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
|||||||
&& rm miniconda.sh
|
&& rm miniconda.sh
|
||||||
|
|
||||||
CONDA=/usr/share/miniconda
|
CONDA=/usr/share/miniconda
|
||||||
setEtcEnvironmentVariable "CONDA" "${CONDA}"
|
set_etc_environment_variable "CONDA" "${CONDA}"
|
||||||
|
|
||||||
ln -s $CONDA/bin/conda /usr/bin/conda
|
ln -s $CONDA/bin/conda /usr/bin/conda
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ source $HELPER_SCRIPTS/os.sh
|
|||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
REPO_URL="https://repo.mongodb.org/apt/ubuntu"
|
REPO_URL="https://repo.mongodb.org/apt/ubuntu"
|
||||||
osLabel=$(getOSVersionLabel)
|
osLabel=$(get_os_version_label)
|
||||||
toolsetVersion=$(get_toolset_value '.mongodb.version')
|
toolsetVersion=$(get_toolset_value '.mongodb.version')
|
||||||
|
|
||||||
# Install Mongo DB
|
# Install Mongo DB
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ source $HELPER_SCRIPTS/os.sh
|
|||||||
LSB_CODENAME=$(lsb_release -cs)
|
LSB_CODENAME=$(lsb_release -cs)
|
||||||
|
|
||||||
# There are no packages for Ubuntu 22 in the repo, but developers confirmed that packages from Ubuntu 20 should work
|
# There are no packages for Ubuntu 22 in the repo, but developers confirmed that packages from Ubuntu 20 should work
|
||||||
if isUbuntu22; then
|
if is_ubuntu22; then
|
||||||
LSB_CODENAME="focal"
|
LSB_CODENAME="focal"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export NVM_DIR="/etc/skel/.nvm"
|
|||||||
mkdir $NVM_DIR
|
mkdir $NVM_DIR
|
||||||
VERSION=$(curl -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
|
VERSION=$(curl -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
|
||||||
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
|
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
|
||||||
setEtcEnvironmentVariable "NVM_DIR" '$HOME/.nvm'
|
set_etc_environment_variable "NVM_DIR" '$HOME/.nvm'
|
||||||
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ source $HELPER_SCRIPTS/install.sh
|
|||||||
|
|
||||||
# add repository for old Ubuntu images
|
# add repository for old Ubuntu images
|
||||||
# details in thread: https://github.com/actions/runner-images/issues/6331
|
# details in thread: https://github.com/actions/runner-images/issues/6331
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
apt-add-repository ppa:ondrej/php -y
|
apt-add-repository ppa:ondrej/php -y
|
||||||
apt-get update
|
apt-get update
|
||||||
fi
|
fi
|
||||||
@@ -94,7 +94,7 @@ sudo mv composer.phar /usr/bin/composer
|
|||||||
php -r "unlink('composer-setup.php');"
|
php -r "unlink('composer-setup.php');"
|
||||||
|
|
||||||
# Add composer bin folder to path
|
# Add composer bin folder to path
|
||||||
prependEtcEnvironmentPath '$HOME/.config/composer/vendor/bin'
|
prepend_etc_environment_path '$HOME/.config/composer/vendor/bin'
|
||||||
|
|
||||||
#Create composer folder for user to preserve folder permissions
|
#Create composer folder for user to preserve folder permissions
|
||||||
mkdir -p /etc/skel/.composer
|
mkdir -p /etc/skel/.composer
|
||||||
@@ -106,7 +106,7 @@ mv phpunit /usr/local/bin/phpunit
|
|||||||
|
|
||||||
# ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php
|
# ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php
|
||||||
# see https://github.com/actions/runner-images/issues/1084
|
# see https://github.com/actions/runner-images/issues/1084
|
||||||
if isUbuntu20; then
|
if is_ubuntu20; then
|
||||||
rm /etc/apt/sources.list.d/ondrej-*.list
|
rm /etc/apt/sources.list.d/ondrej-*.list
|
||||||
apt-get update
|
apt-get update
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ REPO_URL="https://apt.postgresql.org/pub/repos/apt/"
|
|||||||
|
|
||||||
# Preparing repo for PostgreSQL
|
# Preparing repo for PostgreSQL
|
||||||
wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /usr/share/keyrings/postgresql.gpg
|
wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /usr/share/keyrings/postgresql.gpg
|
||||||
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] $REPO_URL $(getOSVersionLabel)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] $REPO_URL $(get_os_version_label)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
# Fetch PostgreSQL version to install from the toolset
|
# Fetch PostgreSQL version to install from the toolset
|
||||||
toolsetVersion=$(get_toolset_value '.postgresql.version')
|
toolsetVersion=$(get_toolset_value '.postgresql.version')
|
||||||
|
|||||||
@@ -7,70 +7,69 @@
|
|||||||
source $HELPER_SCRIPTS/install.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
# This function installs PyPy using the specified arguments:
|
# This function installs PyPy using the specified arguments:
|
||||||
# $1=PACKAGE_URL
|
# $1=package_url
|
||||||
function InstallPyPy
|
install_pypy() {
|
||||||
{
|
local package_url=$1
|
||||||
PACKAGE_URL=$1
|
|
||||||
|
|
||||||
PACKAGE_TAR_NAME=$(echo "$PACKAGE_URL" | awk -F/ '{print $NF}')
|
package_tar_name=$(echo "$package_url" | awk -F/ '{print $NF}')
|
||||||
PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/}
|
package_name=${package_tar_name/.tar.bz2/}
|
||||||
|
|
||||||
echo "Downloading tar archive '$PACKAGE_NAME'"
|
echo "Downloading tar archive '$package_name'"
|
||||||
PACKAGE_TAR_TEMP_PATH=$(download_with_retry $PACKAGE_URL)
|
package_tar_temp_path=$(download_with_retry $package_url)
|
||||||
|
|
||||||
echo "Expand '$PACKAGE_NAME' to the /tmp folder"
|
echo "Expand '$package_name' to the /tmp folder"
|
||||||
tar xf "$PACKAGE_TAR_TEMP_PATH" -C /tmp
|
tar xf "$package_tar_temp_path" -C /tmp
|
||||||
|
|
||||||
# Get Python version
|
# Get Python version
|
||||||
MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1)
|
major_version=$(echo ${package_name/pypy/} | cut -d. -f1)
|
||||||
PYTHON_MAJOR="python$MAJOR_VERSION"
|
python_major="python$major_version"
|
||||||
|
|
||||||
if [ $MAJOR_VERSION != 2 ]; then
|
if [ $major_version != 2 ]; then
|
||||||
PYPY_MAJOR="pypy$MAJOR_VERSION"
|
pypy_major="pypy$major_version"
|
||||||
else
|
else
|
||||||
PYPY_MAJOR="pypy"
|
pypy_major="pypy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
|
package_temp_folder="/tmp/$package_name"
|
||||||
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
|
python_full_version=$("$package_temp_folder/bin/$pypy_major" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
|
||||||
PYPY_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(*sys.pypy_version_info[0:3]))")
|
pypy_full_version=$("$package_temp_folder/bin/$pypy_major" -c "import sys;print('{}.{}.{}'.format(*sys.pypy_version_info[0:3]))")
|
||||||
echo "Put '$PYPY_FULL_VERSION' to PYPY_VERSION file"
|
echo "Put '$pypy_full_version' to PYPY_VERSION file"
|
||||||
echo $PYPY_FULL_VERSION > "$PACKAGE_TEMP_FOLDER/PYPY_VERSION"
|
echo $pypy_full_version > "$package_temp_folder/PYPY_VERSION"
|
||||||
|
|
||||||
# PyPy folder structure
|
# PyPy folder structure
|
||||||
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
|
pypy_toolcache_path=$AGENT_TOOLSDIRECTORY/PyPy
|
||||||
PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
|
pypy_toolcache_version_path=$pypy_toolcache_path/$python_full_version
|
||||||
PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64
|
pypy_toolcache_version_arch_path=$pypy_toolcache_version_path/x64
|
||||||
|
|
||||||
echo "Check if PyPy hostedtoolcache folder exist..."
|
echo "Check if PyPy hostedtoolcache folder exist..."
|
||||||
if [ ! -d $PYPY_TOOLCACHE_PATH ]; then
|
if [ ! -d $pypy_toolcache_path ]; then
|
||||||
mkdir -p $PYPY_TOOLCACHE_PATH
|
mkdir -p $pypy_toolcache_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder"
|
echo "Create PyPy '$pypy_toolcache_version_path' folder"
|
||||||
mkdir $PYPY_TOOLCACHE_VERSION_PATH
|
mkdir $pypy_toolcache_version_path
|
||||||
|
|
||||||
echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder"
|
echo "Move PyPy '$package_temp_folder' binaries to '$pypy_toolcache_version_arch_path' folder"
|
||||||
mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH
|
mv $package_temp_folder $pypy_toolcache_version_arch_path
|
||||||
|
|
||||||
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
|
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
|
||||||
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
|
cd $pypy_toolcache_version_arch_path/bin
|
||||||
|
|
||||||
# Starting from PyPy 7.3.4 these links are already included in the package
|
# Starting from PyPy 7.3.4 these links are already included in the package
|
||||||
[ -f ./$PYTHON_MAJOR ] || ln -s $PYPY_MAJOR $PYTHON_MAJOR
|
[ -f ./$python_major ] || ln -s $pypy_major $python_major
|
||||||
[ -f ./python ] || ln -s $PYTHON_MAJOR python
|
[ -f ./python ] || ln -s $python_major python
|
||||||
|
|
||||||
chmod +x ./python ./$PYTHON_MAJOR
|
chmod +x ./python ./$python_major
|
||||||
|
|
||||||
echo "Install latest Pip"
|
echo "Install latest Pip"
|
||||||
./python -m ensurepip
|
./python -m ensurepip
|
||||||
./python -m pip install --ignore-installed pip
|
./python -m pip install --ignore-installed pip
|
||||||
|
|
||||||
echo "Create complete file"
|
echo "Create complete file"
|
||||||
touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete
|
touch $pypy_toolcache_version_path/x64.complete
|
||||||
|
|
||||||
echo "Remove '$PACKAGE_TAR_TEMP_PATH'"
|
echo "Remove '$package_tar_temp_path'"
|
||||||
rm -f $PACKAGE_TAR_TEMP_PATH
|
rm -f $package_tar_temp_path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Installation PyPy
|
# Installation PyPy
|
||||||
@@ -87,7 +86,7 @@ for toolsetVersion in $toolsetVersions; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
InstallPyPy $latestMajorPyPyVersion
|
install_pypy $latestMajorPyPyVersion
|
||||||
done
|
done
|
||||||
|
|
||||||
chown -R "$SUDO_USER:$SUDO_USER" "$AGENT_TOOLSDIRECTORY/PyPy"
|
chown -R "$SUDO_USER:$SUDO_USER" "$AGENT_TOOLSDIRECTORY/PyPy"
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ export PIPX_HOME=/opt/pipx
|
|||||||
python3 -m pip install pipx
|
python3 -m pip install pipx
|
||||||
python3 -m pipx ensurepath
|
python3 -m pipx ensurepath
|
||||||
# Update /etc/environment
|
# Update /etc/environment
|
||||||
setEtcEnvironmentVariable "PIPX_BIN_DIR" $PIPX_BIN_DIR
|
set_etc_environment_variable "PIPX_BIN_DIR" $PIPX_BIN_DIR
|
||||||
setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME
|
set_etc_environment_variable "PIPX_HOME" $PIPX_HOME
|
||||||
prependEtcEnvironmentPath $PIPX_BIN_DIR
|
prepend_etc_environment_path $PIPX_BIN_DIR
|
||||||
# Test pipx
|
# Test pipx
|
||||||
if ! command -v pipx; then
|
if ! command -v pipx; then
|
||||||
echo "pipx was not installed or not found on PATH"
|
echo "pipx was not installed or not found on PATH"
|
||||||
@@ -29,6 +29,6 @@ if ! command -v pipx; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Adding this dir to PATH will make installed pip commands are immediately available.
|
# Adding this dir to PATH will make installed pip commands are immediately available.
|
||||||
prependEtcEnvironmentPath '$HOME/.local/bin'
|
prepend_etc_environment_path '$HOME/.local/bin'
|
||||||
|
|
||||||
invoke_tests "Tools" "Python"
|
invoke_tests "Tools" "Python"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
# install R
|
# install R
|
||||||
osLabel=$(getOSVersionLabel)
|
osLabel=$(get_os_version_label)
|
||||||
|
|
||||||
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor > /usr/share/keyrings/rlang.gpg
|
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor > /usr/share/keyrings/rlang.gpg
|
||||||
echo "deb [signed-by=/usr/share/keyrings/rlang.gpg] https://cloud.r-project.org/bin/linux/ubuntu $osLabel-cran40/" > /etc/apt/sources.list.d/rlang.list
|
echo "deb [signed-by=/usr/share/keyrings/rlang.gpg] https://cloud.r-project.org/bin/linux/ubuntu $osLabel-cran40/" > /etc/apt/sources.list.d/rlang.list
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ source $CARGO_HOME/env
|
|||||||
# Install common tools
|
# Install common tools
|
||||||
rustup component add rustfmt clippy
|
rustup component add rustfmt clippy
|
||||||
|
|
||||||
if isUbuntu22; then
|
if is_ubuntu22; then
|
||||||
cargo install bindgen-cli cbindgen cargo-audit cargo-outdated
|
cargo install bindgen-cli cbindgen cargo-audit cargo-outdated
|
||||||
else
|
else
|
||||||
cargo install --locked bindgen-cli cbindgen cargo-audit cargo-outdated
|
cargo install --locked bindgen-cli cbindgen cargo-audit cargo-outdated
|
||||||
@@ -29,6 +29,6 @@ fi
|
|||||||
rm -rf ${CARGO_HOME}/registry/*
|
rm -rf ${CARGO_HOME}/registry/*
|
||||||
|
|
||||||
# Update /etc/environemnt
|
# Update /etc/environemnt
|
||||||
prependEtcEnvironmentPath '$HOME/.cargo/bin'
|
prepend_etc_environment_path '$HOME/.cargo/bin'
|
||||||
|
|
||||||
invoke_tests "Tools" "Rust"
|
invoke_tests "Tools" "Rust"
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ SELENIUM_FULL_VERSION=$(echo $SELENIUM_DOWNLOAD_URL | awk -F"selenium-server-|.j
|
|||||||
touch "/usr/share/java/selenium-server-$SELENIUM_FULL_VERSION"
|
touch "/usr/share/java/selenium-server-$SELENIUM_FULL_VERSION"
|
||||||
|
|
||||||
# Add SELENIUM_JAR_PATH environment variable
|
# Add SELENIUM_JAR_PATH environment variable
|
||||||
setEtcEnvironmentVariable "SELENIUM_JAR_PATH" "$SELENIUM_JAR_PATH"
|
set_etc_environment_variable "SELENIUM_JAR_PATH" "$SELENIUM_JAR_PATH"
|
||||||
|
|
||||||
invoke_tests "Tools" "Selenium"
|
invoke_tests "Tools" "Selenium"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ source $HELPER_SCRIPTS/install.sh
|
|||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
# Install libssl1.1 dependency
|
# Install libssl1.1 dependency
|
||||||
if isUbuntu22; then
|
if is_ubuntu22; then
|
||||||
libssl_deb_path=$(download_with_retry "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb")
|
libssl_deb_path=$(download_with_retry "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb")
|
||||||
libssl_hash="0b3251aee55db6e20d02f4b9a2b703c9874a85ab6a20b12f4870f52f91633d37"
|
libssl_hash="0b3251aee55db6e20d02f4b9a2b703c9874a85ab6a20b12f4870f52f91633d37"
|
||||||
use_checksum_comparison "$libssl_deb_path" "$libssl_hash"
|
use_checksum_comparison "$libssl_deb_path" "$libssl_hash"
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ ln -s "$SWIFT_BIN_ROOT/swift" /usr/local/bin/swift
|
|||||||
ln -s "$SWIFT_BIN_ROOT/swiftc" /usr/local/bin/swiftc
|
ln -s "$SWIFT_BIN_ROOT/swiftc" /usr/local/bin/swiftc
|
||||||
ln -s "$SWIFT_LIB_ROOT/libsourcekitdInProc.so" /usr/local/lib/libsourcekitdInProc.so
|
ln -s "$SWIFT_LIB_ROOT/libsourcekitdInProc.so" /usr/local/lib/libsourcekitdInProc.so
|
||||||
|
|
||||||
setEtcEnvironmentVariable "SWIFT_PATH" "${SWIFT_BIN_ROOT}"
|
set_etc_environment_variable "SWIFT_PATH" "${SWIFT_BIN_ROOT}"
|
||||||
|
|
||||||
invoke_tests "Common" "Swift"
|
invoke_tests "Common" "Swift"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ source $HELPER_SCRIPTS/etc-environment.sh
|
|||||||
|
|
||||||
# Set env variable for vcpkg
|
# Set env variable for vcpkg
|
||||||
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
|
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
|
||||||
setEtcEnvironmentVariable "VCPKG_INSTALLATION_ROOT" "${VCPKG_INSTALLATION_ROOT}"
|
set_etc_environment_variable "VCPKG_INSTALLATION_ROOT" "${VCPKG_INSTALLATION_ROOT}"
|
||||||
|
|
||||||
# Install vcpkg
|
# Install vcpkg
|
||||||
git clone https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT
|
git clone https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT
|
||||||
|
|||||||
@@ -8,68 +8,67 @@
|
|||||||
# values containg slashes (i.e. directory path)
|
# values containg slashes (i.e. directory path)
|
||||||
# The values containing '%' will break the functions
|
# The values containing '%' will break the functions
|
||||||
|
|
||||||
getEtcEnvironmentVariable () {
|
get_etc_environment_variable() {
|
||||||
variable_name="$1"
|
local variable_name=$1
|
||||||
|
|
||||||
# remove `variable_name=` and possible quotes from the line
|
# remove `variable_name=` and possible quotes from the line
|
||||||
grep "^${variable_name}=" /etc/environment | sed -E "s%^${variable_name}=\"?([^\"]+)\"?.*$%\1%"
|
grep "^${variable_name}=" /etc/environment | sed -E "s%^${variable_name}=\"?([^\"]+)\"?.*$%\1%"
|
||||||
}
|
}
|
||||||
|
|
||||||
addEtcEnvironmentVariable () {
|
add_etc_environment_variable() {
|
||||||
variable_name="$1"
|
local variable_name=$1
|
||||||
variable_value="$2"
|
local variable_value=$2
|
||||||
|
|
||||||
echo "${variable_name}=${variable_value}" | sudo tee -a /etc/environment
|
echo "${variable_name}=${variable_value}" | sudo tee -a /etc/environment
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceEtcEnvironmentVariable () {
|
replace_etc_environment_variable() {
|
||||||
variable_name="$1"
|
local variable_name=$1
|
||||||
variable_value="$2"
|
local variable_value=$2
|
||||||
|
|
||||||
# modify /etc/environemnt in place by replacing a string that begins with variable_name
|
# modify /etc/environemnt in place by replacing a string that begins with variable_name
|
||||||
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=\"${variable_value}\"%" /etc/environment
|
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=\"${variable_value}\"%" /etc/environment
|
||||||
}
|
}
|
||||||
|
|
||||||
setEtcEnvironmentVariable () {
|
set_etc_environment_variable() {
|
||||||
variable_name="$1"
|
local variable_name=$1
|
||||||
variable_value="$2"
|
local variable_value=$2
|
||||||
|
|
||||||
if grep "^${variable_name}=" /etc/environment > /dev/null
|
if grep "^${variable_name}=" /etc/environment > /dev/null; then
|
||||||
then
|
replace_etc_environment_variable $variable_name $variable_value
|
||||||
replaceEtcEnvironmentVariable $variable_name $variable_value
|
|
||||||
else
|
else
|
||||||
addEtcEnvironmentVariable $variable_name $variable_value
|
add_etc_environment_variable $variable_name $variable_value
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
prependEtcEnvironmentVariable () {
|
prepend_etc_environment_variable() {
|
||||||
variable_name="$1"
|
local variable_name=$1
|
||||||
element="$2"
|
local element=$2
|
||||||
|
|
||||||
# TODO: handle the case if the variable does not exist
|
# TODO: handle the case if the variable does not exist
|
||||||
existing_value=$(getEtcEnvironmentVariable "${variable_name}")
|
existing_value=$(get_etc_environment_variable "${variable_name}")
|
||||||
setEtcEnvironmentVariable "${variable_name}" "${element}:${existing_value}"
|
set_etc_environment_variable "${variable_name}" "${element}:${existing_value}"
|
||||||
}
|
}
|
||||||
|
|
||||||
appendEtcEnvironmentVariable () {
|
append_etc_environment_variable() {
|
||||||
variable_name="$1"
|
local variable_name=$1
|
||||||
element="$2"
|
local element=$2
|
||||||
|
|
||||||
# TODO: handle the case if the variable does not exist
|
# TODO: handle the case if the variable does not exist
|
||||||
existing_value=$(getEtcEnvironmentVariable "${variable_name}")
|
existing_value=$(get_etc_environment_variable "${variable_name}")
|
||||||
setEtcEnvironmentVariable "${variable_name}" "${existing_value}:${element}"
|
set_etc_environment_variable "${variable_name}" "${existing_value}:${element}"
|
||||||
}
|
}
|
||||||
|
|
||||||
prependEtcEnvironmentPath () {
|
prepend_etc_environment_path() {
|
||||||
element="$1"
|
local element=$1
|
||||||
|
|
||||||
prependEtcEnvironmentVariable PATH "${element}"
|
prepend_etc_environment_variable PATH "${element}"
|
||||||
}
|
}
|
||||||
|
|
||||||
appendEtcEnvironmentPath () {
|
append_etc_environment_path() {
|
||||||
element="$1"
|
local element=$1
|
||||||
|
|
||||||
appendEtcEnvironmentVariable PATH "${element}"
|
append_etc_environment_variable PATH "${element}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Process /etc/environment as if it were shell script with `export VAR=...` expressions
|
# Process /etc/environment as if it were shell script with `export VAR=...` expressions
|
||||||
@@ -81,10 +80,10 @@ appendEtcEnvironmentPath () {
|
|||||||
# TODO: there might be the others variables to be processed in the same way as "PATH" variable
|
# TODO: there might be the others variables to be processed in the same way as "PATH" variable
|
||||||
# ie MANPATH, INFOPATH, LD_*, etc. In the current implementation the values from /etc/evironments
|
# ie MANPATH, INFOPATH, LD_*, etc. In the current implementation the values from /etc/evironments
|
||||||
# replace the values of the current environment
|
# replace the values of the current environment
|
||||||
reloadEtcEnvironment () {
|
reload_etc_environment() {
|
||||||
# add `export ` to every variable of /etc/environemnt except PATH and eval the result shell script
|
# add `export ` to every variable of /etc/environemnt except PATH and eval the result shell script
|
||||||
eval $(grep -v '^PATH=' /etc/environment | sed -e 's%^%export %')
|
eval $(grep -v '^PATH=' /etc/environment | sed -e 's%^%export %')
|
||||||
# handle PATH specially
|
# handle PATH specially
|
||||||
etc_path=$(getEtcEnvironmentVariable PATH)
|
etc_path=$(get_etc_environment_variable PATH)
|
||||||
export PATH="$PATH:$etc_path"
|
export PATH="$PATH:$etc_path"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
download_with_retry() {
|
download_with_retry() {
|
||||||
url=$1
|
local url=$1
|
||||||
download_path=$2
|
local download_path=$2
|
||||||
|
|
||||||
if [ -z "$download_path" ]; then
|
if [ -z "$download_path" ]; then
|
||||||
download_path="/tmp/$(basename "$url")"
|
download_path="/tmp/$(basename "$url")"
|
||||||
@@ -45,15 +45,6 @@ download_with_retry() {
|
|||||||
echo "$download_path"
|
echo "$download_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Use dpkg to figure out if a package has already been installed
|
|
||||||
## Example use:
|
|
||||||
## if ! IsPackageInstalled packageName; then
|
|
||||||
## echo "packageName is not installed!"
|
|
||||||
## fi
|
|
||||||
IsPackageInstalled() {
|
|
||||||
dpkg -S $1 &> /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
get_toolset_value() {
|
get_toolset_value() {
|
||||||
local toolset_path="/imagegeneration/installers/toolset.json"
|
local toolset_path="/imagegeneration/installers/toolset.json"
|
||||||
local query=$1
|
local query=$1
|
||||||
|
|||||||
@@ -4,17 +4,14 @@
|
|||||||
## Desc: Helper functions for OS releases
|
## Desc: Helper functions for OS releases
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
function isUbuntu20
|
is_ubuntu20() {
|
||||||
{
|
|
||||||
lsb_release -d | grep -q 'Ubuntu 20'
|
lsb_release -d | grep -q 'Ubuntu 20'
|
||||||
}
|
}
|
||||||
|
|
||||||
function isUbuntu22
|
is_ubuntu22() {
|
||||||
{
|
|
||||||
lsb_release -d | grep -q 'Ubuntu 22'
|
lsb_release -d | grep -q 'Ubuntu 22'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOSVersionLabel
|
get_os_version_label() {
|
||||||
{
|
|
||||||
lsb_release -cs
|
lsb_release -cs
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user