blob: 45b368193937f293c93b47736abbc49ca4fc294e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# Maintainer: Nikos Toutountzoglou <nikos dot toutou at protonmail dot com>
pkgname=thor-flash-utility
pkgver=1.0.4
pkgrel=6
pkgdesc="Utility for flashing firmware on Samsung devices, based on dotnet 7.0"
arch=('x86_64' 'aarch64')
url="https://github.com/Samsung-Loki/Thor"
license=('MPL-2.0')
depends=('dotnet-runtime-7.0' 'gcc-libs' 'glibc')
makedepends=('dotnet-sdk-7.0')
optdepends=('android-udev: Adds udev rules for non-root users (Group adbusers)')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/Samsung-Loki/Thor/archive/refs/tags/${pkgver}.tar.gz")
sha256sums=('7c6a5482a2a6a0af2711849441f8a8227bca240e38ab56ba9a50ed6eb13ed78e')
prepare() {
# Set up environment variables for dotnet CLI
export DOTNET_CLI_HOME="${srcdir}"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
cd "${srcdir}/Thor-${pkgver}"
# Patch project files to add RuntimeIdentifiers for both x86_64 and aarch64
sed -i "/<TargetFramework>net7.0<\/TargetFramework>/a <RuntimeIdentifiers>linux-x64;linux-arm64<\/RuntimeIdentifiers>" \
"TheAirBlow.Thor.Library/TheAirBlow.Thor.Library.csproj"
sed -i "/<TargetFramework>net7.0<\/TargetFramework>/a <RuntimeIdentifiers>linux-x64;linux-arm64<\/RuntimeIdentifiers>" \
"TheAirBlow.Thor.Shell/TheAirBlow.Thor.Shell.csproj"
# Restore dotnet packages
dotnet restore "TheAirBlow.Thor.Library/TheAirBlow.Thor.Library.csproj" \
--packages "${srcdir}/nuget_packages"
dotnet restore "TheAirBlow.Thor.Shell/TheAirBlow.Thor.Shell.csproj" \
--packages "${srcdir}/nuget_packages"
}
build() {
# Set up environment variables for dotnet CLI
export DOTNET_CLI_HOME="${srcdir}"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
cd "${srcdir}/Thor-${pkgver}"
# Determine the runtime based on the architecture
if [ "$CARCH" = "x86_64" ]; then
runtime="linux-x64"
elif [ "$CARCH" = "aarch64" ]; then
runtime="linux-arm64"
else
echo "Unsupported architecture: $CARCH"
exit 1
fi
# Publish the Thor Library project
cd "${srcdir}/Thor-${pkgver}/TheAirBlow.Thor.Library"
dotnet publish \
--configuration Release \
--output "${srcdir}/publish" \
--runtime "$runtime" \
--no-self-contained \
--nologo
# Publish the Thor Shell project
cd "${srcdir}/Thor-${pkgver}/TheAirBlow.Thor.Shell"
dotnet publish \
--configuration Release \
--output "${srcdir}/publish" \
--runtime "$runtime" \
--no-self-contained \
--nologo
}
package() {
cd "${srcdir}/publish"
# Install the binaries and other necessary files
install -Dm644 *.{dll,json} -t "${pkgdir}/opt/${pkgname}"
install -Dm755 TheAirBlow.Thor.Shell -t "${pkgdir}/opt/${pkgname}"
# Create a symlink in /usr/bin
install -d "${pkgdir}/usr/bin"
ln -s "/opt/${pkgname}/TheAirBlow.Thor.Shell" "${pkgdir}/usr/bin/${pkgname}"
}
# vim: set ts=2 sw=2 et:
|