From 82d2c68abb28fc928fc2e3eeca01d6255f832875 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Mon, 21 Oct 2024 09:35:11 +0530 Subject: [PATCH] Update linux-installer script --- .../build-ballerina-linux-deb-x64.sh | 8 ++++++-- .../resources/{ => amd}/DEBIAN/control | 0 .../resources/{ => amd}/DEBIAN/postinst | 0 .../resources/{ => amd}/DEBIAN/postrm | 0 .../linux-deb/resources/arm/DEBIAN/control | 10 ++++++++++ .../linux-deb/resources/arm/DEBIAN/postinst | 20 +++++++++++++++++++ .../linux-deb/resources/arm/DEBIAN/postrm | 3 +++ 7 files changed, 39 insertions(+), 2 deletions(-) rename installers/linux-deb/resources/{ => amd}/DEBIAN/control (100%) rename installers/linux-deb/resources/{ => amd}/DEBIAN/postinst (100%) rename installers/linux-deb/resources/{ => amd}/DEBIAN/postrm (100%) create mode 100644 installers/linux-deb/resources/arm/DEBIAN/control create mode 100755 installers/linux-deb/resources/arm/DEBIAN/postinst create mode 100755 installers/linux-deb/resources/arm/DEBIAN/postrm diff --git a/installers/linux-deb/build-ballerina-linux-deb-x64.sh b/installers/linux-deb/build-ballerina-linux-deb-x64.sh index 10428fb66b..e221291a5d 100755 --- a/installers/linux-deb/build-ballerina-linux-deb-x64.sh +++ b/installers/linux-deb/build-ballerina-linux-deb-x64.sh @@ -113,7 +113,11 @@ function createPackInstallationDirectory() { } function copyDebianDirectory() { - cp -R resources/DEBIAN target/${BALLERINA_INSTALL_DIRECTORY}/DEBIAN + if [ "$ARCH" = "arm" ]; then + cp -R resources/arm/DEBIAN target/${BALLERINA_INSTALL_DIRECTORY}/DEBIAN + else + cp -R resources/amd/DEBIAN target/${BALLERINA_INSTALL_DIRECTORY}/DEBIAN + fi sed -i -e 's/__BALLERINA_VERSION__/'${BALLERINA_VERSION}'/g' target/${BALLERINA_INSTALL_DIRECTORY}/DEBIAN/postinst sed -i -e 's/__BALLERINA_VERSION__/'${BALLERINA_VERSION}'/g' target/${BALLERINA_INSTALL_DIRECTORY}/DEBIAN/postrm sed -i -e 's/__BALLERINA_VERSION__/'${BALLERINA_VERSION}'/g' target/${BALLERINA_INSTALL_DIRECTORY}/DEBIAN/control @@ -127,7 +131,7 @@ function createBallerinaPlatform() { extractPack "$BALLERINA_DISTRIBUTION_LOCATION/$BALLERINA_PLATFORM.zip" ${BALLERINA_PLATFORM} createPackInstallationDirectory copyDebianDirectory - mv target/${BALLERINA_INSTALL_DIRECTORY} target/ballerina-${BALLERINA_VERSION}-linux-x64 + mv target/${BALLERINA_INSTALL_DIRECTORY} target/${BALLERINA_PLATFORM}-x64 fakeroot dpkg-deb --build target/${BALLERINA_PLATFORM}-x64 } diff --git a/installers/linux-deb/resources/DEBIAN/control b/installers/linux-deb/resources/amd/DEBIAN/control similarity index 100% rename from installers/linux-deb/resources/DEBIAN/control rename to installers/linux-deb/resources/amd/DEBIAN/control diff --git a/installers/linux-deb/resources/DEBIAN/postinst b/installers/linux-deb/resources/amd/DEBIAN/postinst similarity index 100% rename from installers/linux-deb/resources/DEBIAN/postinst rename to installers/linux-deb/resources/amd/DEBIAN/postinst diff --git a/installers/linux-deb/resources/DEBIAN/postrm b/installers/linux-deb/resources/amd/DEBIAN/postrm similarity index 100% rename from installers/linux-deb/resources/DEBIAN/postrm rename to installers/linux-deb/resources/amd/DEBIAN/postrm diff --git a/installers/linux-deb/resources/arm/DEBIAN/control b/installers/linux-deb/resources/arm/DEBIAN/control new file mode 100644 index 0000000000..1a252637c9 --- /dev/null +++ b/installers/linux-deb/resources/arm/DEBIAN/control @@ -0,0 +1,10 @@ +Package: ballerina-__BALLERINA_VERSION__ +Version: 2-__BALLERINA_VERSION__ +Maintainer: Ballerina +Architecture: arm64 +Description: Ballerina + Ballerina is a general purpose, concurrent and strongly typed + programming language with both textual and graphical syntaxes, + optimized for integration. +Installed-Size: 331000 + diff --git a/installers/linux-deb/resources/arm/DEBIAN/postinst b/installers/linux-deb/resources/arm/DEBIAN/postinst new file mode 100755 index 0000000000..011f81f664 --- /dev/null +++ b/installers/linux-deb/resources/arm/DEBIAN/postinst @@ -0,0 +1,20 @@ +rm -f /usr/lib/ballerina/bin/ballerina +rm -f /usr/bin/bal + +ln -sf /usr/lib/ballerina/bin/bal /usr/bin/bal +echo "export BALLERINA_HOME=/usr/lib/bal" >> /etc/profile.d/wso2.sh + +if [ "$(basename -- "$SHELL")" = "bash" ]; then + bal completion bash > /usr/share/bash-completion/completions/bal + chmod 766 /usr/share/bash-completion/completions/bal +elif [ "$(basename -- "$SHELL")" = "zsh" ]; then + if [ ! -d ~/.ballerina ]; then + mkdir –m766 ~/.ballerina + fi + mkdir -p –m766 ~/.ballerina/completion + echo 'fpath=(~/.ballerina/completion $fpath)' >> ~/.zshrc + echo 'autoload -U compinit && compinit' >> ~/.zshrc + \cp /usr/lib/ballerina/scripts/_bal ~/.ballerina/completion/ + chmod 766 ~/.ballerina/completion/_bal +fi + diff --git a/installers/linux-deb/resources/arm/DEBIAN/postrm b/installers/linux-deb/resources/arm/DEBIAN/postrm new file mode 100755 index 0000000000..c10fba120e --- /dev/null +++ b/installers/linux-deb/resources/arm/DEBIAN/postrm @@ -0,0 +1,3 @@ +sudo rm /usr/bin/bal +sed -i.bak '/BALLERINA_HOME/d' /etc/profile.d/wso2.sh +