summarylogtreecommitdiffstats
path: root/build_installer.sh
blob: ade56bcd5900beec487c700c3b1d6c56dc1b3876 (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
#!/bin/sh

# Buildscript for creating the distribution independed installer.
# Works only in this directory because some dependencies are here located.

set -e

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

elcsum=""
mscsum="ca66a6113ce98152b85c8d847949f8c90ab9ba798e106bfc225d4ed3c2e2e3e2"
rcsum=""

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

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

if [ ! -f "./makeself-2.4.0.run" ] ;then
    if [ ! -x "$(which curl)" ] ;then
	echo "Curl not found. Curl are needed for downloading makeself build tool."
	echo " Please install curl with your Package Manager."
	printf "\nExiting.\n\n"
	exit 0
    fi
    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 from makeself-2.4.0.run doesn't match!"
    printf "\nExiting.\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 $(ls ../eve-icons*.tar.gz) ;do tar xf $eia -C evesetup/ ;done
for eta in $(ls ../eve-transl5.11-??.tar.gz) ;do cp $eta evesetup/ ;done
for cmd in evelauncher.sh everegedit evewine evewinecfg evewinetricks ;do
    if [ -f ../$cmd ] ;then cp ../$cmd evesetup/ ;fi
    if [ ! "$cmd" = "evewine" ] ;then cp ../${cmd%.*}.desktop evesetup/ ;fi
done
cp ../evelauncher.shlib evesetup/evelauncher.shlib
cp ../evelauncher.sh.in evesetup/evelauncher.sh
sed -i s,ELVER=\"\",ELVER=\"$version\", evesetup/evelauncher.sh
grep -v '^#-' ../setup.sh.in >evesetup/setup.sh
#-- testing only
#- cp -f ../setup.sh.in evesetup/setup.sh
#- sed -i 's,#- , ,' evesetup/setup.sh
#- release="test"
#--
sed -i s,elver=\"\",elver=\"$version\", evesetup/setup.sh
sed -i s,elcsum=\"\",elcsum=\"$elcsum\", 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
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."