#!/bin/sh set -e bootstrap_install() { install -dv "$destdir" install -dv "$bindir" install -dv "$libdir" install -d "$prefix/bin/" install -d "$prefix/share/applications/" for eta in ./eve-transl${qtver}-??.tar.gz ;do install -m 0644 "$eta" "$libdir" done install -m 0644 "./evesetup.shlib" "$libdir" install -m 0644 "./evelauncher-${elver}.tar.gz" "$libdir" sed -i s,./eve-transl,$libdir/eve-transl, ./evelauncher.sh sed -i s,SETUPDIR=\"\",SETUPDIR=\"$destdir\", ./evelauncher.sh for cmd in evelauncher.sh evewine evewinetricks everegedit evewinecfg evebackup ;do if [ -f "./$cmd" ] ;then sed -i s,./evesetup.shlib,$libdir/evesetup.shlib, ./$cmd install "./$cmd" "$bindir/" else ln -sf evewine "$bindir/$cmd" fi [ "$bindir" != "$prefix/bin" ] && ln -s "$bindir/$cmd" "$prefix/bin/$cmd" if [ ! "$cmd" = "evewine" ] ;then oexec=$(grep Exec= ./${cmd%.*}.desktop) sed -i s,$oexec,Exec=$prefix/bin/$cmd, ./${cmd%.*}.desktop install -m 0644 "./${cmd%.*}.desktop" "$prefix/share/applications/" fi done for icons in $(find . -type f -name '*.png') ;do install -D -m 0644 "$icons" "$prefix/share/${icons#*/}" done if [ -x $(which gtk-update-icon-cache) ] ;then if [ -f "${prefix}/share/icons/hicolor/icon-theme.cache" ] ;then gtk-update-icon-cache -t -f "${prefix}/share/icons/hicolor" 2>/dev/null chmod 0644 "${prefix}/share/icons/hicolor/icon-theme.cache" fi fi } bootstrap_remove() { for icons in $(find . -type f -name '*.png') ;do rm -f "$prefix/share/${icons#*/}" done for cmd in evelauncher.sh everegedit evewine evewinecfg evewinetricks evebackup ;do rm -fv "$prefix/bin/$cmd" if [ ! "$cmd" = "evewine" ] ;then rm -f "$prefix/share/applications/${cmd%.*}.desktop" fi done rm -rfv "$destdir" } build_lib() { if [ ! -r "./evelauncher-$elver.tar.gz" ] ;then if [ -x "$(which curl 2>/dev/null)" ] ;then echo "Curl version $(curl -V | head -n1 | cut -d' ' -f2) found." else echo "Curl not found. Curl are needed for downloading evelauncher binaries." echo " Please install curl with your Package Manager." printf "\nLeaving.\n\n" exit 0 fi printf "\nDownload evelauncher-$elver.tar.gz...\n\n" curl -L -O https://binaries.eveonline.com/evelauncher-$elver.tar.gz fi rcsum="$(sha256sum ./evelauncher-$elver.tar.gz| cut -d' ' -f1)" if [ "$rcsum" != "$elcsum" ] ;then printf "\n\nError: Checksum from evelauncher-$elver.tar.gz doesn't match!" printf "\nLeaving.\n\n" exit 0 fi printf "\nExtract evelauncher-$elver.tar.gz..." tar xf evelauncher-$elver.tar.gz echo "done." printf "\nClean up evelauncher directory..." cd evelauncher/ rm -f ./*.a ./*.la ./*.prl ./libxcb* chmod 0755 ./* chmod 0644 ./*.qm ./*.conf ./errorpage/* echo "done." printf "\nReplace identical files with symbolic links..." ln -sf evelauncher.sh LogLite.sh libb=/dev/zero for lib in $(find ./ -maxdepth 1 -type f -name 'lib*' -printf '%s-%f\n'|sort -r) do liba=${lib#*-} if [ "$(cmp -s $liba $libb; echo $?)" = "0" ] ;then ln -sf $libb $liba else libb=$liba fi done echo "done." printf "\nRemove unneeded symbols from files..." find ./ -maxdepth 1 -type f -exec strip -s {} 2>/dev/null \; echo "done." printf "\nRepack evelauncher-$elver.tar.gz..." touch ./* cd ../ rm evelauncher-$elver.tar.gz tar czf evelauncher-$elver.tar.gz evelauncher/ rm -rf evelauncher/ echo "done." } check_req() { if [ -x "$(which wine 2>/dev/null)" ] ;then echo "Wine version $(wine --version) found." else echo "Wine not found. Please install Wine with your Package Manager." echo "WineHQ or Developer Version are recommended." printf "\nLeaving.\n\n" exit 0 fi if [ -x "$(which winetricks 2>/dev/null)" ] ;then echo "Winetricks version $(winetricks --version | cut -d' ' -f1) found." else echo "Winetricks not found. Winetricks are required." echo " Please install Winetricks with your Package Manager." printf "\nLeaving.\n\n" exit 0 fi } prefix="/usr" destdir="/opt/evesetup" bindir="$destdir/bin" libdir="$destdir/lib" qtver="5.11" elver="" elcsum="" rcsum="" key="" if [ $(id -u) -ne 0 ] ;then printf "\nEVE Online Launcher Setup need root permissions." printf "\nLeaving.\n\n" exit 0 fi if [ -d "$destdir" ] ;then printf "\n" read -p 'Remove EVE Online Launcher Setup? (Y/n) ' key [ ! "x$(echo $key | tr [:upper:] [:lower:])" = "xn" ] && \ printf "\nRemoving...\n\n" bootstrap_remove else printf "\n" read -p 'Install EVE Online Launcher Setup? (Y/n) ' key [ ! "x$(echo $key | tr [:upper:] [:lower:])" = "xn" ] && \ check_req && \ build_lib && \ printf "\nInstalling...\n\n" bootstrap_install && \ printf "\nYou can now start EVE Online Launcher and his Tools:\n\n" for cmd in *.desktop ;do oexec=$(grep Exec= $cmd | cut -d= -f2); oexec=${oexec##*/} [ ! "$oexec" = "evelauncher.sh" ] && \ printf " $oexec\t- $(grep Comment= $cmd | cut -d= -f2)\n" done printf "\n evelauncher.sh\t- EVE Online Launcher\n" fi printf "\nDone.\n\n"