From 557387f69c36c5d403f536e7960c93813fa0e196 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Tue, 18 Jan 2022 21:18:47 +0100 Subject: [PATCH] Create dotnet buildscript for armhf --- external/build-dotnet.sh | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 external/build-dotnet.sh diff --git a/external/build-dotnet.sh b/external/build-dotnet.sh new file mode 100644 index 0000000..813531d --- /dev/null +++ b/external/build-dotnet.sh @@ -0,0 +1,75 @@ +#/bin/bash + +runtime_version="3.1" + +echo "1. Parse latest version of dotnet-runtime-${runtime_version}." +version_info=$(curl --silent "https://dotnetcli.blob.core.windows.net/dotnet/Runtime/${runtime_version}/latest.version") +download_link="https://dotnetcli.azureedge.net/dotnet/Runtime/${version_info}/dotnet-runtime-${version_info}-linux-arm.tar.gz" + +echo "2. Create control files for deb" +mkdir -p deb +cd deb + +export NAME="dotnet-runtime-${runtime_version}" +export MAINAINER=".NET Core Team " +#export VERSION="${version_info}" +export VERSION="3.0.0" +export DESCRIPTION="Microsoft .NET Core Runtime - ${version_info}" +export PLATFORM=armhf + +curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/control-build.sh | bash + +echo "#!/bin/bash" > postinst +echo "" >> postinst +echo "if [ \"\$1\" = \"configure\" ]; then" >> postinst +echo " chown -R root:root /usr/share/dotnet" >> postinst +echo " ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet" >> postinst +echo "fi" >> postinst + +echo "#!/bin/bash" > prerm +echo "" >> prerm +echo "rm /usr/bin/dotnet" >> prerm +cd .. + +echo "3. Catch all paths together for $NAME." +HOMEDIR=$HOME +ROOT="$HOMEDIR/deb" +EXEC="$ROOT/usr/share/dotnet" +DEBIAN="$ROOT/DEBIAN" +TARGETFILE="${NAME}_${VERSION}_${PLATFORM}.deb" + +echo "4. Create directorys." +mkdir -p $EXEC +mkdir -p $DEBIAN + +echo "5. Move deb control files." +cp deb/control $DEBIAN/control +cp deb/postinst $DEBIAN/postinst +cp deb/prerm $DEBIAN/prerm +rm deb -r + +echo "6. Copy programm files to $EXEC." +wget -q $download_link -O dotnet.tar.gz +tar -zxf dotnet.tar.gz -C $EXEC +rm dotnet.tar.gz + +echo "7. Creating md5sum" +touch $DEBIAN/md5sums +pushd $ROOT >> /dev/null +find . -path ./DEBIAN -prune -o -type f -exec md5sum {} \; | sed "s-./--" >> $DEBIAN/md5sums +popd >> /dev/null + +echo "8. Setting permissions" +chmod -R 755 $DEBIAN + +echo "9. Build deb packet." +dpkg-deb --build $ROOT + +echo "10. Move $TARGETFILE to Builds." +mv $HOMEDIR/deb.deb "$TARGETFILE" +echo "::set-output name=debuilderfile::$TARGETFILE" + +echo "11. Cleanup $HOMEDIR/deb." +rm $HOMEDIR/deb -r + +echo "All steps completed." \ No newline at end of file