dda-devops-build/infrastructure/clj/image/resources/install.sh

61 lines
2.5 KiB
Bash
Raw Normal View History

2023-07-21 15:40:24 +00:00
#!/bin/bash
2023-12-07 19:38:43 +00:00
set -exo pipefail
2023-07-21 15:40:24 +00:00
function main() {
2023-12-07 19:38:43 +00:00
{
2023-07-21 15:40:24 +00:00
upgradeSystem
2024-02-17 07:49:38 +00:00
apt-get -qqy install curl git openjdk-17-jre-headless leiningen build-essential libz-dev zlib1g-dev
2023-12-07 19:38:43 +00:00
2023-07-21 15:40:24 +00:00
# download kubeconform & graalvm
2023-12-07 19:38:43 +00:00
kubeconform_version="0.6.4"
2024-02-16 17:05:27 +00:00
graalvm_jdk_version="21.0.2"
2023-12-07 19:38:43 +00:00
curl -SsLo /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/kubeconform-linux-amd64.tar.gz
curl -SsLo /tmp/CHECKSUMS https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/CHECKSUMS
curl -SsLo /tmp/graalvm-community-jdk.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz
curl -SsLo /tmp/graalvm-checksum https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz.sha256
# checksum kubeconform & graalvm-jdk
checksum
2023-07-21 15:40:24 +00:00
# install kubeconform
2023-12-07 19:38:43 +00:00
tar -C /usr/local/bin -xf /tmp/kubeconform.tar.gz --exclude=LICENSE
2023-07-21 15:40:24 +00:00
# install graalvm
2023-12-07 19:38:43 +00:00
tar -C /usr/lib/jvm/ -xf /tmp/graalvm-community-jdk.tar.gz
dirname_graalvm=$(ls /usr/lib/jvm/|grep -e graa)
ln -s /usr/lib/jvm/$dirname_graalvm /usr/lib/jvm/graalvm
2023-07-21 15:40:24 +00:00
ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2
ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin
#install pyb
2023-12-07 19:38:43 +00:00
apt-get -qqy install python3 python3-pip
pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages
2023-07-21 15:40:24 +00:00
2024-02-17 10:45:36 +00:00
#check
native-image --help
lein --help
2023-07-21 15:40:24 +00:00
cleanupDocker
2023-12-07 19:38:43 +00:00
} > /dev/null
}
function checksum() {
checksum_kubeconform=$(awk '{print $1}' /tmp/CHECKSUMS|sed -n '2p')
sha256sum_kubeconform=$(sha256sum /tmp/kubeconform.tar.gz|awk '{print $1}')
checksum_graalvm_jdk=$(awk '{print $1}' /tmp/graalvm-checksum)
sha256sum_graalvm_jdk=$(sha256sum /tmp/graalvm-community-jdk.tar.gz|awk '{print $1}')
if [ $checksum_kubeconform == $sha256sum_kubeconform -a $checksum_graalvm_jdk == $sha256sum_graalvm_jdk ]; then
echo "Kubeconform & graalvm_jdk checksum verification succesful"
else
echo "Failure in kubeconform|graalvm_jdk checksum verification"
exit 1
fi
2023-07-21 15:40:24 +00:00
}
source /tmp/install_functions_debian.sh
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main