summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: aceb2f08ecb61430b2da931603881177eba2ea85 (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
# Maintainer: Samuel Mesa <samuelmesa@linuxmail.org>
# Contributor: Alex Hirzel
# Contributor: Marcel Korpel <marcel[dot]korpel[at]gmail>
# Contributor: Leandro de Assis <leandrodiassis@gmail.com>
# Contributor: Thomas Dziedzic
# Contributor: Christoph Fink <christoph.fink@gmail.com>

pkgname=geoserver-bin
pkgver=2.26.1
pkgrel=1
pkgdesc="Server written in Java that allows users to share and edit geospatial data"
arch=("any")
url="https://geoserver.org"
license=("GPL-2.0-or-later")
java_ver=17
depends=("java-runtime" "jre${java_ver}-openjdk-headless")


source=(
    "http://downloads.sourceforge.net/project/geoserver/GeoServer/${pkgver}/geoserver-${pkgver}-bin.zip"
    "geoserver.install"
    "geoserver.service"
    "geoserver.sysusers"
)
sha256sums=('a8a957570cc2352f9d8ae3a8e37ab49dfc0f94832e50f398d4e6a82adf662fe8'
            '576c36670c418aa25730986e592c8b0f4a0657d3129aafbe7c783ff3ed527abe'
            '8a785d95da48d4a97d9f3620256b2a7fe607680dc932b5ee2dbcd6473352d126'
            'edd692b53b71a684b20e0e7a87b0047aaefc2286574355fb5c08770af2652d08')

install="geoserver.install"

package() {
    # create a dedicated user
    install -Dm644 ../geoserver.sysusers "${pkgdir}/usr/lib/sysusers.d/geoserver.conf"

    # clean up: remove windows file, move license file
    # to /usr/share/licenses
    rm bin/{startup,shutdown}.bat
    licenses=(license/*)
    for lic in "${licenses[@]}"
    do
        install -Dm644 $lic "${pkgdir}/usr/share/licenses/${pkgname}/${lic}"
        rm $lic
    done

    # install geoserver to /opt/geoserver/${pkgver}
    mkdir -p "${pkgdir}/opt/geoserver/"
    cp -R . "${pkgdir}/opt/geoserver/${pkgver}"

    # adjust data directory permissions
    find "${pkgdir}/opt/geoserver/${pkgver}/data_dir/data" -type d -exec chmod 0775 {} \;
    find "${pkgdir}/opt/geoserver/${pkgver}/data_dir/data" -type f -exec chmod 0664 {} \;

    # install geoserver as a systemd service
    sed "s/{pkgver}/${pkgver}/g" -i ../geoserver.service
    sed "s/{java_ver}/${java_ver}/g" -i ../geoserver.service
    install -Dm644 ../geoserver.service "${pkgdir}/usr/lib/systemd/system/geoserver.service"

    # custom startup/shutdown links
    mkdir -p "${pkgdir}/usr/bin"
    ln -s "/opt/geoserver/${pkgver}/bin/startup.sh" "${pkgdir}/usr/bin/geoserver-startup"
    ln -s "/opt/geoserver/${pkgver}/bin/shutdown.sh" "${pkgdir}/usr/bin/geoserver-shutdown"

    # create /etc/profile.d/ file to set environment
    # variables (used when geoserver is started manually)
    mkdir -p "${pkgdir}/etc/profile.d"
    echo "export GEOSERVER_HOME=/opt/geoserver/${pkgver}/" > "${pkgdir}/etc/profile.d/geoserver.sh"
    chmod +x "${pkgdir}/etc/profile.d/geoserver.sh"

    # Fix marlin
    # https://docs.geoserver.org/latest/en/user/production/java.html#running-on-java-17
    rm "${pkgdir}/opt/geoserver/${pkgver}/webapps/geoserver/WEB-INF/lib/marlin-0.9.4.8.jar"

    # remove dead symlinks
	rm "${pkgdir}/opt/geoserver/2.26.1/geoserver-2.26.1-bin.zip"
	rm "${pkgdir}/opt/geoserver/2.26.1/geoserver.install"
	rm "${pkgdir}/opt/geoserver/2.26.1/geoserver.service"
	rm "${pkgdir}/opt/geoserver/2.26.1/geoserver.sysusers"
}