commit:     37baa79165e6395d5712d5e4ab51c5a266120202
Author:     Vadim A. Misbakh-Soloviov <git <AT> mva <DOT> name>
AuthorDate: Wed Jun 21 06:21:31 2017 +0000
Commit:     Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
CommitDate: Wed Jun 21 06:21:31 2017 +0000
URL:        https://gitweb.gentoo.org/proj/gamerlay.git/commit/?id=37baa791

kerbal: fix

 .../kerbal-space-program/files/ksp-wrapper         | 43 ++++++++++++++++++
 ...uild => kerbal-space-program-1.3.0.1804.ebuild} | 51 +++++++++++++---------
 2 files changed, 74 insertions(+), 20 deletions(-)

diff --git a/games-simulation/kerbal-space-program/files/ksp-wrapper 
b/games-simulation/kerbal-space-program/files/ksp-wrapper
new file mode 100644
index 0000000..fcbf49a
--- /dev/null
+++ b/games-simulation/kerbal-space-program/files/ksp-wrapper
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+arch="$(uname -m)"
+arch="${arch/i[2-6]/x}"
+PV="__PV__"
+s_dir="/usr/share/kerbal-space-program-${PV}"
+t_dir="${HOME}/.local/share/kerbal-space-program"
+
+
+mkdir -p "${t_dir}"
+cd "${t_dir}";
+
+IPV=$(cat .version 2>/dev/null)
+
+if [[ "${IPV}" != "${PV}" ]]; then
+       cat .content 2>/dev/null | rev | while read t; do
+               if [[ -d "${t}" ]]; then
+                       rmdir "${f}" &>/dev/null
+               else
+                       rm "${t}" &>/dev/null
+               fi
+       done
+
+       echo -n '' > .content # truncate -s0 ?
+       cd "${s_dir}"
+
+       find * | while read t; do
+               if [[ -d "${t}" ]]; then
+                       mkdir -p "${t_dir}/${t}"
+               else
+               # Hardlinks with owner/rights change is not allowed,
+               # and symlinks doesn't work (game engine dereferences
+               # them and still complains on missing write access)
+                       cp "${s_dir}/${t}" "${t_dir}/${t}"
+               fi
+               echo "${t}" >> "${t_dir}"/.content
+       done
+       echo "${PV}" > "${t_dir}"/.version
+fi
+
+export LC_NUMERIC="C"
+cd "${t_dir}";
+exec "./KSP.${arch}" "$@"

diff --git 
a/games-simulation/kerbal-space-program/kerbal-space-program-2.13.0.16.ebuild 
b/games-simulation/kerbal-space-program/kerbal-space-program-1.3.0.1804.ebuild
similarity index 60%
rename from 
games-simulation/kerbal-space-program/kerbal-space-program-2.13.0.16.ebuild
rename to 
games-simulation/kerbal-space-program/kerbal-space-program-1.3.0.1804.ebuild
index 64582c5..7b542dd 100644
--- 
a/games-simulation/kerbal-space-program/kerbal-space-program-2.13.0.16.ebuild
+++ 
b/games-simulation/kerbal-space-program/kerbal-space-program-1.3.0.1804.ebuild
@@ -7,14 +7,27 @@ inherit eutils
 
 DESCRIPTION="A combination of platformer and role playing game"
 HOMEPAGE="http://www.unepicgame.com/";
-SRC_URI="gog_${P//-/_}.sh"
+
+GOG_MAGIC="2.13.0.16"
+
+SRC_PH="gog_${PN//-/_}@PH@_${GOG_MAGIC}.sh"
+SRC_URI="
+       l10n_en? ( ${SRC_PH//@PH@} )
+       l10n_es? ( ${SRC_PH//@PH@/_spanish} )
+       l10n_ja? ( ${SRC_PH//@PH@/_japanese} )
+       l10n_ru? ( ${SRC_PH//@PH@/_russian} )
+       l10n_zh-CN? ( ${SRC_PH//@PH@/_chinese} )
+"
 
 RESTRICT="fetch strip"
 LICENSE="EULA"
 
 SLOT="0"
 KEYWORDS="amd64 x86"
-IUSE=""
+
+L10NS="l10n_en l10n_es l10n_ja l10n_ru l10n_zh-CN"
+IUSE="${L10NS}"
+REQUIRED_USE="^^ ( ${L10NS} )"
 
 DEPEND="app-arch/unzip"
 RDEPEND="
@@ -39,18 +52,29 @@ pkg_nofetch() {
 }
 
 src_unpack() {
+       local tmp="${WORKDIR}/tmp"
        einfo "\nUnpacking files. This can take several minutes.\n"
 
-       mkdir "${WORKDIR}/tmp" || die "mkdir 'tmp' failed"
-       cd "${WORKDIR}/tmp" || die "cd 'tmp' failed"
+       mkdir "${tmp}" || die "mkdir 'tmp' failed"
+       cd "${tmp}" || die "cd 'tmp' failed"
 
        unzip -q "${DISTDIR}/${A}"
-
        local gpath="data/noarch/game"
 
        mv "${gpath}" "${S}"
 
-       cd "${S}" && rm -r "${WORKDIR}/tmp"
+       cd "${S}"
+
+       use l10n_es && unzip -oq KSP-LANG-ES-ES.zip && rm KSP-LANG-ES-ES.zip
+       use l10n_ja && unzip -oq KSP-LANG-JA.zip && rm KSP-LANG-JA.zip
+       use l10n_ru && unzip -oq KSP-LANG-RU.zip && rm KSP-LANG-RU.zip
+       use l10n_zh-CN && unzip -oq KSP-LANG-ZH-CN.zip && rm KSP-LANG-ZH-CN.zip
+
+       rm -r "${WORKDIR}/tmp"
+
+       find . -name .DS_Store -delete
+
+       sed -e "s@__PV__@${PF}@" "${FILESDIR}/ksp-wrapper" > "${T}"/ksp-wrapper
 }
 
 src_install() {
@@ -62,20 +86,7 @@ src_install() {
        doins -r .
        doexe {KSP,Launcher}.x86{,_64} || die "Failed to install executables"
 
+       newbin "${T}/ksp-wrapper" "${PN}"
        newicon "Launcher_Data/Resources/UnityPlayer.png" "${PN}.png"
-       make_wrapper "${PN}" "./KSP.${arch}" "${dir}"
-       make_wrapper "${PN}-launcher" "./Launcher.${arch}" "${dir}"
        make_desktop_entry "${PN}" "Kerbal Space Program" "${PN}" || die 
"make_desktop_entry failed"
-       make_desktop_entry "${PN}-launcher" "Kerbal Space Program: Launcher" 
"${PN}" || die "make_desktop_entry failed"
-}
-
-pkg_postinst() {
-       einfo "Just in case: neither of these DRM-free versions sees Steam's 
savegames."
-       einfo "In case, if you played in Steam and moved to DRM-free version,"
-       einfo "consider copying files from:"
-       einfo "~/.local/share/Steam/userdata/[your_user_id]/233980/remote/save"
-       einfo "to:"
-       einfo "~/.local/share/Unepic/unepic/save"
-       einfo "and vice versa if you want to import DRM-free saves to Steam."
-       einfo "Although, it can cause sudden game freezes..."
 }

Reply via email to