summarylogtreecommitdiffstats
path: root/build_installer.sh
blob: cf0ef9e28f376b6eaf207866c12bea328f8ce9c9 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh

set -e

printf "\n\n Buildscript for the distribution independed installer of"
printf " EVE Online Launcher Setup\n\n"

version=$(grep ^pkgver PKGBUILD | cut -d= -f2) || exit 1
release=$(grep ^pkgrel PKGBUILD | cut -d= -f2) || exit 1
arch=$(uname -m)

dvver=$(grep doitsujin PKGBUILD | cut -d\" -f2 | sed 's,.*-,,;s,.tar.*,,' )
dvcsum=""
elcsum=""
mscsum="ca66a6113ce98152b85c8d847949f8c90ab9ba798e106bfc225d4ed3c2e2e3e2"
rcsum=""

pshal=$(grep -n ^sha256sum PKGBUILD | cut -d: -f1)
psrcl=$(grep -n ^source PKGBUILD | cut -d: -f1)
pdvsl=$(grep -n dxvk-$dvver.tar.gz\" PKGBUILD | cut -d: -f1)
pelsl=$(grep -n evelauncher-\${pkgver}.tar.gz\" PKGBUILD | cut -d: -f1)
pdfsl=$(expr $pdvsl - $psrcl)
pofsl=$(expr $pelsl - $psrcl)
pdvcs=$(expr $pshal + $pdfsl)
pelcs=$(expr $pshal + $pofsl)

plc=1
while read pline ;do
	if [ $plc -eq $pdvcs ] ;then
		dvcsum=${pline#*\'}
		dvcsum=${dvcsum%%\'*}
	fi
	if [ $plc -eq $pelcs ] ;then
		elcsum=${pline#*\'}
		elcsum=${elcsum%%\'*}
	fi
	plc=$(expr $plc + 1)
done < PKGBUILD

if [ ! -x "$(which curl 2>/dev/null)" ] ;then
	printf "\nError: Curl not found. Curl are needed for downloading makeself build tool."
	printf "\n\tPlease install curl with your Package Manager.\n"
	printf "\nLeaving.\n\n"
	exit 0
fi

if [ ! -f "./makeself-2.4.0.run" ] ;then
	printf "\nGet makeself...\n\n"
	curl -L -O https://github.com/megastep/makeself/releases/download/release-2.4.0/makeself-2.4.0.run
fi
rcsum="$(sha256sum ./makeself-2.4.0.run | cut -d' ' -f1)"
if [ "$rcsum" != "$mscsum" ] ;then
	printf "\n\nError: Checksum makeself-2.4.0.run mismatch!"
	printf "\nLeaving.\n\n"
	exit 0
fi

printf "\nCreate clean build environment..."
if [ -d src/ ] ;then rm -rf src/* ;else mkdir src/ ;fi

chmod a+x ./makeself-2.4.0.run
./makeself-2.4.0.run --tar x ./makeself.sh ./makeself-header.sh 2>/dev/null
chmod a-x ./makeself-2.4.0.run
mv ./makeself.sh ./makeself-header.sh src/

cd src/
mkdir evesetup/
echo "done."

printf "\nCopy needed files from AUR source..."
for eia in ../eve-icons*.tar.gz ;do tar xf $eia -C evesetup/ ;done
for eta in ../eve-transl5.12-??.tar.gz ;do cp $eta evesetup/ ;done
for cmd in backup launcher.sh regedit restore wine winecfg winetricks ;do
	cmd=eve$cmd
	if [ -f ../$cmd ] ;then cp ../$cmd evesetup/ ;fi
	if [ ! "$cmd" = "evewine" ] ;then cp ../${cmd%.*}.desktop evesetup/ ;fi
done
cp ../evesetup.shlib evesetup/
cp ../evelauncher.kwinrule evesetup/
cp ../evelauncher.lua evesetup/
cp ../evelauncher.sh.in evesetup/evelauncher.sh
sed -i s,ELVER=\"\",ELVER=\"$version\", evesetup/evelauncher.sh
cp ../setup.sh.in evesetup/setup.sh
sed -i s,elver=\"\",elver=\"$version\", evesetup/setup.sh
sed -i s,elcsum=\"\",elcsum=\"$elcsum\", evesetup/setup.sh
sed -i s,dvver=\"\",dvver=\"$dvver\", evesetup/setup.sh
sed -i s,dvcsum=\"\",dvcsum=\"$dvcsum\", evesetup/setup.sh
chmod a+x evesetup/setup.sh
echo "done."

if [ -f "../evelauncher-$version.tar.gz" ] ;then
	printf "\nFound EVE Launcher archive..."
	rcsum="$(sha256sum ../evelauncher-$version.tar.gz | cut -d' ' -f1)"
	if [ "$rcsum" = "$elcsum" ] ;then
		cp ../evelauncher-$version.tar.gz evesetup/ && \
		echo "added."
	else
		echo "skipped, checksum mismatch."
	fi
else
	printf "\nEVE Launcher archive not found, will be downloaded during the setup process.\n"
fi
if [ -f "../dxvk-$dvver.tar.gz" ] ;then
	printf "\nFound DXVK archive..."
	rcsum="$(sha256sum ../dxvk-$dvver.tar.gz | cut -d' ' -f1)"
	if [ "$rcsum" = "$dvcsum" ] ;then
		cp ../dxvk-$dvver.tar.gz evesetup/ && \
		echo "added."
	else
		echo "skipped, checksum mismatch."
	fi
else
	printf "\nDXVK archive not found, will be downloaded during the setup process.\n"
fi
printf "\nBuild self-extractable archive evesetup-$version-$release-$arch.run\n\n"
./makeself.sh --tar-quietly evesetup/ ../evesetup-$version-$release-$arch.run \
	"EVE Online Launcher Setup $version-$release" ./setup.sh
cd ..
printf "\nClean up build environment..."
rm -rf src/
echo "done."