# Note: dotnet use different version number in SDK and runtime
ver=$(cat "$SRCDIR"/sdk-version.txt)
abinfo "Set version to $ver ..."
PKGVER="$ver"

abinfo "Deploying files ..."
install -dv "$PKGDIR"/usr/lib/dotnet
install -dv "$PKGDIR"/usr/lib/dotnet/packs
mv -v "$SRCDIR"/output/sdk "$PKGDIR"/usr/lib/dotnet # 3
mv -v "$SRCDIR"/output/sdk-manifests "$PKGDIR"/usr/lib/dotnet # 4
# Note: exclude sdk-aot content
mv -v "$SRCDIR"/output/packs/Microsoft.NETCore.App.Runtime.!(NativeAOT*) "$PKGDIR"/usr/lib/dotnet/packs # 18
mv -v "$SRCDIR"/output/packs/Microsoft.AspNetCore.App.Runtime.* "$PKGDIR"/usr/lib/dotnet/packs # 18
if ! ab_match_arch ppc64el; then
    # Note: ppc64el use mono runtime
    mv -v "$SRCDIR"/output/library-packs "$PKGDIR"/usr/lib/dotnet # 4
fi

abinfo "Copying managed debug symbols ..."
ABSTRIP=1
ABSPLITDBG=1
filter_pdb
ABSTRIP=0
ABSPLITDBG=0

# Note: use first 6 character of version as band version is not strict.
# But according to current release schedule, it is very unlikely to have 10 SDK bands in 3 years
# without bump minor version, and .NET SDK 100.0.100 will be released at 2115 CE.
band="${ver:0:6}"00
# Install workloads on user directory, otherwise will broke when upgrade
abinfo "Configuring .NET workload install path for SDK band $band ..."
mkdir -pv "$PKGDIR"/usr/lib/dotnet/metadata/workloads/"$band"/
touch "$PKGDIR"/usr/lib/dotnet/metadata/workloads/"$band"/userlocal
