summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cf5e34314138a1592089e049b08578eef03b5ad7 (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=4243
_gamepkg=RimWorldIdeology1-5-${_pkg_subver}Linux.tar.gz

pkgname=rimworld-ideology
pkgver=1.5.${_pkg_subver}
pkgrel=1
pkgdesc="Expansion pack Ideology 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/RimWorldIdeology1-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/Ideology/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-ideology"
}