summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f2d86cfa5f3b4be5978553e9f2ee29fa518e3c5c (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
# Maintainer: Sebastien Duthil <duthils@duthils.net>

_pkg_subver=4066
_gamepkg=RimWorldAnomaly1-5-${_pkg_subver}Linux.tar.gz

pkgname=rimworld-anomaly
pkgver=1.5.${_pkg_subver}
pkgrel=1
pkgdesc="Expansion pack Anomaly for the game Rimworld"
arch=('i686' 'x86_64')
url="http://rimworldgame.com/"
license=('custom: commercial')
depends=('rimworld')
makedepends=('tar')
source=()

_pkgpaths_tries=("$startdir"
                 "$HOME/Downloads")

build() {
  msg "You need a full copy of this game and its expansion in order to install it"

  # look for game tarball
  for pkgpath_try in "${_pkgpaths_tries[@]}" ; do
    msg "Searching for ${_gamepkg} in dir: \"${pkgpath_try}\""
    if [[ -f "${pkgpath_try}/${_gamepkg}" ]]; then
      pkgpath=${pkgpath_try}
      break
    fi
  done

  # not found: ask for path to game tarball
  if [[ ! -f "${pkgpath}/${_gamepkg}" ]]; then
    error "Game package not found, please type absolute path to ${_gamepkg} (/home/joe):"
    read pkgpath
    if [[ ! -f "${pkgpath}/${_gamepkg}" ]]; then
        error "Unable to find game package."
        return 1
    fi
  fi

  # unpack game tarball
  msg "Found game package, unpacking..."
  tar -xf "${pkgpath}/${_gamepkg}" -C "${srcdir}"
}

package() {
  cd "$srcdir"

  cd "$srcdir/RimWorldAnomaly1-5-${_pkg_subver}Linux"
  install -dm755 "$pkgdir/opt/rimworld"
  cp -r Data "$pkgdir/opt/rimworld"

  # remove non-ascii characters in filename causing warnings
  for file in "$pkgdir/opt/rimworld/Data/Anomaly/Languages/"*.tar ; do
    mv "$file" "${file/ */}.tar"
  done

  install -dm755 "$pkgdir/usr/share/licenses"
  ln -s "${pkgdir}/usr/share/licenses/rimworld" "${pkgdir}/usr/share/licenses/rimworld-anomaly"
}