summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: db7eb8b25e5dd6cc526bf6b5f92f1f236b658e31 (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
# Maintainer Adrian Woźniak <adrian.wozniak@ita-prog.pl>

pkgbase=amdfand-bin
pkgname=amdfand-bin
pkgver=1.0.6
pkgrel=1
pkgdesc="AMDGPU Fan control service"
url="https://github.com/Eraden/amdgpud"
license=('MIT' 'Apache-2.0')
_source=(
  "https://github.com/Eraden/amdgpud/releases/download/${pkgver}/build.tar.gz"
)
arch=('x86_64')
_md5sums=(
  'eb496cca24bba7647d37c6bc38e1aae2'
)
depends=(
)
keywords=(
  'amdgpu'
  'controller'
  'fan'
)

prepare() {
    cd $srcdir/
    echo "Due to 'makepkg' and 'PKGBUILD' specs limitations I need to download sources and validate them by myself"
    for source_url in ${_source[@]}; do
        source_filename=${source_url##*/}
        if [ ! -f "$source_filename" ]; then
            echo "Downloading next source - $source_filename ..."
            curl -O -L "$source_url";
        else
            echo "Found already downloaded source - $source_filename"
        fi
    done
    echo "And now we must validated dowanloaded sources ..."
    for (( i=0; i<${#_source[@]}; ++i )); do
        source_url=${_source[i]}
        source_filename=${source_url##*/}
        source_expected_md5sum=${_md5sums[i]}
        source_actual_md5sum=$(md5sum $source_filename | awk '{print $1}')
        if [ "$source_actual_md5sum" == "$source_expected_md5sum" ]; then
            echo "Validated next source - $source_filename"
        else
            echo "Found corrupted source - $source_filename"; return 1
        fi
    done    
}

build() {
    cd $srcdir/
    tar -xvf $srcdir/build.tar.gz
}

package() {
    cd $srcdir/
    mkdir -p $pkgdir/usr/bin/
    mkdir -p $pkgdir/usr/lib/systemd/system/
    install -m 0755 $srcdir/amdfand $pkgdir/usr/bin
    install -m 0755 $srcdir/amdfand.service "$pkgdir/usr/lib/systemd/system/amdfand.service"
}

#vim: syntax=sh