summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 999a1c4eae93f9e23e3f0a8e6c85e3f571872145 (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
# Maintainer: Cranky Supertoon <crankysupertoon@gmail.com>
pkgname="modsman"
pkgver="0.32.1"
pkgrel=3
commithash="6add8e25be26080164cd4f84ce5338b8d98e4e4e"
shorthash="g6add8e2"
arch=('x86_64')
pkgdesc="Minecraft mod manager and updater for the CLI"
url='https://github.com/sargunv/modsman'
license=('GPL3')
makedepends=('gendesk' 'unzip' 'git')
depends=('java-runtime=8')
conflicts=('modsman-git' 'modsman-bin')
source=("${pkgname}::git+${url}.git")
md5sums=('SKIP')

prepare() {
    #Rebase project to proper commit
    #because the project cannot be built dirty
    cd "${srcdir}/${pkgname}"
    git reset --hard ${commithash}

    # Create Startup Script
    cat > "${pkgname}-app" <<-EOT
#!/bin/sh
cd /opt/modsman/bin
./modsman-cli
EOT
}

build() {
    cd "${srcdir}/${pkgname}"
    ./gradlew :${pkgname}-cli:distZip --info --stacktrace
}

package() {

    # Unzip Compiled project
    cd "${srcdir}/${pkgname}/${pkgname}-cli/build/distributions"
    unzip -o ${pkgname}-cli-${pkgver}-1-${shorthash}.dirty.zip
    rm -rf "${pkgname}/"
    cp -r "${pkgname}-cli-${pkgver}-1-${shorthash}.dirty/" "${pkgname}/"
    rm -f "modsman/bin/${pkgname}-cli.bat"

    # install the main files.
    install -d -m755 "${pkgdir}/opt/${pkgname}"
    cp -Rr "${srcdir}/${pkgname}/modsman-cli/build/distributions/modsman" "${pkgdir}/opt/"

    # fix file permissions - all files as 644 - directories as 755
    find "${pkgdir}/"opt -type d -exec chmod 755 {} \;
    find "${pkgdir}/"opt -type f -exec chmod 644 {} \;

    # link the binary
    install -d -m755 "${pkgdir}/usr/bin"
    cp -Rr "${srcdir}/${pkgname}/${pkgname}-app" "${pkgdir}/usr/bin/${pkgname}"

    # make sure the main binary has the right permissions
    chmod +x "${pkgdir}/usr/bin/${pkgname}"
    chmod +x "${pkgdir}/opt/${pkgname}/bin/${pkgname}-cli"
}