summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 523174cee523dbb6700be07506024f62f6d16b5b (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
# Maintainer: Mirko Scholz

pkgname=ccdc-mercury
pkgver=4.1.0
pkgrel=1
pkgdesc="Crystal Structure Visualisation, Exploration and Analysis Made Easy"
arch=(x86_64)
url="https://www.ccdc.cam.ac.uk/solutions/csd-system/components/mercury/"
license=(unknown)
depends=(glib2 opengl-driver libx11)
[ "${CARCH}" = "x86_64" ] && depends=("${depends[@]}")
makedepends=(fakechroot)

_installer="mercurystandalone-${pkgver}-linux-x64-installer.run"

source=("https://downloads.ccdc.cam.ac.uk/Mercury/$pkgver/$_installer")

sha256sums=('19f2d737340766e78469636f32e822bd2eb97796dcc5d576a53f748aec61e6fd')

options=(!strip)


prepare() 
{
	cd $srcdir/
	chmod +x "$_installer"
}

package()
{
	local _prefix="/opt/Mercury-$pkgver"

	# follows https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=microchip-mplabx-bin
	mkdir -p "$pkgdir"/{etc,tmp,opt}
	mkdir -p "$pkgdir"/usr/bin
	ln -s /usr/bin "$pkgdir"
	echo "root:x:0:0:root:/root:/bin/bash" > "${pkgdir}/etc/passwd"
	echo "root:x:0:root" > "${pkgdir}/etc/group"
	cp --reflink=auto --dereference "$srcdir/$_installer" "$pkgdir/tmp"
	cat << EOF > "$pkgdir/tmp/install.sh"
#!/bin/sh
PATH=/bin
echo Running Mercury installer...	
"/tmp/$_installer" \
	--mode unattended \
	--debuglevel 4 \
	--materials false \
	--prefix "$_prefix"
EOF
	chmod 0755 "$pkgdir/tmp/install.sh"

	fakechroot chroot "$pkgdir" /tmp/install.sh

	rm -f $pkgdir/$_prefix/autoupdate
	rm -f $pkgdir/$_prefix/uninstall
	rm -f $pkgdir/$_prefix/uninstall.dat
	
	sed -i 's/^check_for_updates *= *1/check_for_updates = 0/' "$pkgdir/$_prefix/update_software.ini"
	rm -rf "$pkgdir"/{etc,tmp,bin}
	
	cat << EOF > "$pkgdir/usr/bin/Mercury"
#!/bin/sh
exec "$_prefix/bin/mercury" "\$@"
EOF
	cat << EOF > "$pkgdir/usr/bin/encifer"
#!/bin/sh
exec "$_prefix/bin/encifer" "\$@"
EOF
	chmod 0755 "$pkgdir/usr/bin/Mercury" "$pkgdir/usr/bin/encifer" 

}