updated on Sat Jan 21 04:00:54 UTC 2012
[aur-mirror.git] / defcon-humblebundle / PKGBUILD
blobd54ed6e7042a68d60282ec8a1714c7a71974cab3
1 # Maintainer: Naelstrof <naelstrof at gmail dot com>
2 pkgname=defcon-humblebundle
3 pkgver=1.6
4 pkgrel=1
5 pkgdesc=""
6 arch=('i686' 'x86_64')
7 url="http://www.humblebundle.com/"
8 license=('custom')
9 groups=('humblebundle')
10 depends=(libgl mesa libvorbis sdl)
11 source=('defcon.desktop')
12 md5sums=('4d2d32e8fd9c7b9746e58afb2b0f1a85')
14 if [ "${CARCH}" = "x86_64" ]; then
15         _carch=amd64
16         _archive_md5="aacecb7e05cc9a2cf31fce8f87fb5cb6"
17 else
18         _carch=i386
19         _archive_md5="231461515874c1d394e3bec0324ab32d"
22 _realname="defcon"
23 _packagename="${_realname}_${pkgver}-${pkgrel}_${_carch}.tar.gz"
24 _archive="${srcdir}/${_packagename}"
26 build() {
27     #download archive if key is available
28     if [ ! -f ${_archive} ] && [ -n "${_humbleintbundlekey}" ]; then
29         rm -f index.html\?key\=${_humbleintbundlekey}*
30         wget http://www.humblebundle.com/?key=${_humbleintbundlekey}
31         wget $(cat index.html\?key\=${_humbleintbundlekey} | grep "${_packagename}" | cut -d "'" -f 10)
32         mv ${_packagename}* ${_archive}
33     fi
35         #check game files
36         if [ ! -f ${_archive} ]; then
37                 echo "
38 To install this you must own a copy of this game from ${url}."
39                 echo "Place ${_realname}_${pkgver}-${pkgrel}_${_carch}.tar.gz into ${srcdir}.
41         echo "Alternatively you can add 'export _humbleintbundlekey=<Your key here>' to ~/.bashrc if you want automated download ability. (You must restart your terminal for this to take effect)
43                 echo "Press ENTER to continue."
44                 read -a _unused
45         fi
46         if [ ! -f ${_archive} ]; then
47                 echo "${_archive} not found, exiting..."
48                 return 1
49         fi
50         if ! echo "${_archive_md5} ${_archive}" | md5sum -c --quiet; then
51                 echo "Invalid checksum for ${_archive}, exiting..."
52                 return 1
53         fi
54         
55         #install all game files to /opt
56         install -d ${pkgdir}/opt
57         tar xvf ${_archive} -C ${pkgdir}/opt
58         
59         #remove arch specific name from binary
60         if [ -d ${pkgdir}/opt/Defcon ]; then
61                 mv ${pkgdir}/opt/Defcon ${pkgdir}/opt/defcon
62         fi
63         if [ ! -f ${pkgdir}/opt/defcon/defcon.bin ]; then
64             mv ${pkgdir}/opt/defcon/defcon.bin* ${pkgdir}/opt/defcon/defcon.bin
65     fi
67         #install game icon
68         install -d ${pkgdir}/usr/share/pixmaps/
69         install -D -m644 ${pkgdir}/opt/defcon/defcon.png ${pkgdir}/usr/share/pixmaps/
70         
71         #install application shortcut
72         install -d ${pkgdir}/usr/share/applications
73         cp ${srcdir}/defcon.desktop ${pkgdir}/usr/share/applications/
74         
75         #install license
76         install -d ${pkgdir}/usr/share/licenses/${pkgname}
77         install -D -m644 ${pkgdir}/opt/defcon/license.txt ${pkgdir}/usr/share/licenses/${pkgname}/
78         
79         #remove unneeded files
80         if [ "${CARCH}" = "x86_64" ]; then
81                 rm -rf ${pkgdir}/opt/defcon/lib64
82         else
83                 rm -rf ${pkgdir}/opt/defcon/lib32
84         fi