forked from meissa/ModeratorElection
73 lines
2.5 KiB
Bash
Executable file
73 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -exo pipefail
|
|
|
|
function main()
|
|
{
|
|
upgradeSystem
|
|
#unzpip only necessary for gradle installation within main()
|
|
apt-get -qqy install curl git build-essential libz-dev zlib1g-dev
|
|
mkdir /usr/local/src/ModeratorElection
|
|
|
|
#change to main branch for production
|
|
#change to MEapp-development branch for development
|
|
git clone --single-branch --branch main https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
|
|
|
|
#download gradle
|
|
#gradle_version="8.4"
|
|
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip
|
|
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip.sha256 https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip.sha256
|
|
|
|
#download graalvm
|
|
#graalvm-community-jdk, v22.0.1 2024-04-16
|
|
graalvm_jdk_version="22.0.1"
|
|
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 graalvm
|
|
checksum
|
|
|
|
#install graalvm
|
|
graalvm_inst
|
|
|
|
#nativeCompile
|
|
buildproc
|
|
|
|
cleanupDocker
|
|
|
|
} > /dev/null
|
|
|
|
function checksum() {
|
|
#graalvm
|
|
echo " /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz"|tee -a /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
|
sha256sum -c --status /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
|
}
|
|
|
|
function graalvm_inst(){
|
|
mkdir /usr/lib/jvm/
|
|
tar -C /usr/lib/jvm/ -xzf /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz
|
|
dirname_graalvm=$(ls /usr/lib/jvm/|grep -e graa)
|
|
ln -s /usr/lib/jvm/$dirname_graalvm /usr/lib/jvm/graalvm
|
|
ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
|
|
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 0
|
|
}
|
|
|
|
function buildproc() {
|
|
cd /usr/local/src/ModeratorElection/
|
|
#for dev
|
|
#npm install -g npm@latest
|
|
#npm audit fix
|
|
#npm ci --omit=dev
|
|
|
|
#build jar
|
|
#./gradlew clean build -Pvaadin.productionMode -x processTestAot
|
|
#cp -r doc/META-INF src/main/resources
|
|
#build graalvm binary
|
|
./gradlew nativeCompile -Dvaadin.productionMode=true
|
|
}
|
|
|
|
source /tmp/install_functions_debian.sh
|
|
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
|
|
|
|
|
|
|