74 lines
2.3 KiB
Bash
74 lines
2.3 KiB
Bash
#/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 <dotnetpackages@dotnetfoundation.org>"
|
|
export VERSION="${version_info}"
|
|
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." |