Skip to content

Commit

Permalink
Merge pull request #5754 from NipunaMadhushan/add-linux-arm-installer
Browse files Browse the repository at this point in the history
Update linux-installer script
  • Loading branch information
NipunaMadhushan authored Oct 21, 2024
2 parents aa4d887 + 82d2c68 commit 6a2b125
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 2 deletions.
8 changes: 6 additions & 2 deletions installers/linux-deb/build-ballerina-linux-deb-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down
10 changes: 10 additions & 0 deletions installers/linux-deb/resources/arm/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: ballerina-__BALLERINA_VERSION__
Version: 2-__BALLERINA_VERSION__
Maintainer: Ballerina <[email protected]>
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

20 changes: 20 additions & 0 deletions installers/linux-deb/resources/arm/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions installers/linux-deb/resources/arm/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sudo rm /usr/bin/bal
sed -i.bak '/BALLERINA_HOME/d' /etc/profile.d/wso2.sh

0 comments on commit 6a2b125

Please sign in to comment.