diff options
Diffstat (limited to 'games-rpg')
| -rw-r--r-- | games-rpg/morrowind-data/Manifest | 1 | ||||
| -rw-r--r-- | games-rpg/morrowind-data/files/steam-mail.py | 47 | ||||
| -rw-r--r-- | games-rpg/morrowind-data/metadata.xml | 10 | ||||
| -rw-r--r-- | games-rpg/morrowind-data/morrowind-data-9999.ebuild | 135 |
4 files changed, 193 insertions, 0 deletions
diff --git a/games-rpg/morrowind-data/Manifest b/games-rpg/morrowind-data/Manifest new file mode 100644 index 00000000..1857bb69 --- /dev/null +++ b/games-rpg/morrowind-data/Manifest @@ -0,0 +1 @@ +DIST steamcmd_linux.tar.gz 3170982 SHA256 c7e382f81d5a44036ebb21fd6aa77f68fb4ac0b6d6f4c209ef389b05eba0f9b8 SHA512 747c1cda5cb11e1533b242785fb2d83d8f4b11506e46884c0956769859854ce0c5f450a195f60ffc2da9381a220857f3183c87ee0cfb85d56dc3dfea5db9a155 WHIRLPOOL aaf2ac96bb2ca506323775d897ea6e5dc57a361cbef310941623bead1b7615cdd3d6c7920b9ed4a2eab84a382e5fe4d6b36ceb2bb5701d76ede468a97bb0c68b diff --git a/games-rpg/morrowind-data/files/steam-mail.py b/games-rpg/morrowind-data/files/steam-mail.py new file mode 100644 index 00000000..51bebab0 --- /dev/null +++ b/games-rpg/morrowind-data/files/steam-mail.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +# By eroen <eroen-overlay@occam.eroen.eu>, 2016 +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. + +from __future__ import print_function + +from imaplib import IMAP4_SSL +import re +import sys + + +SERVER = sys.stdin.readline().strip() +USER = sys.stdin.readline().strip() +PASS = sys.stdin.readline().strip() + +if len(SERVER) * len(USER) * len(PASS) <= 0: + print('server, username, and password separated by newlines must be ' + 'supplied on stdin', file=sys.stderr) + sys.exit(1) + +print('conncting to "{}"'.format(SERVER), file=sys.stderr) +M = IMAP4_SSL(SERVER) +# M.enable('UTF8=ACCEPT') +# print(M.capabilities) +print('authenticating', file=sys.stderr) +M.authenticate('PLAIN', lambda response: b'\0' + USER.encode() + b'\0' + + PASS.encode()) +M.select('INBOX') +typ, data = M.search(None, '(FROM "Steam Support")') +index = data[0].split()[-1] +print('found message "{}"'.format(index.decode()), file=sys.stderr) +typ, data = M.fetch(index, '(RFC822)') +message = data[0][1].splitlines() +# print(message) + +r = re.compile(b'Date: ') +date = [l.decode('utf8') for l in message if r.match(l)] +print('message date: "{}"'.format(date[0][6:]), file=sys.stderr) + +r = re.compile(b'[A-Z1-9]{5}$') +keys = [l.decode('utf8') for l in message if r.match(l)] +print(keys[0]) + +M.logout() diff --git a/games-rpg/morrowind-data/metadata.xml b/games-rpg/morrowind-data/metadata.xml new file mode 100644 index 00000000..a94dac11 --- /dev/null +++ b/games-rpg/morrowind-data/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>eroen-overlay@occam.eroen.eu</email> + <name>eroen</name> + </maintainer> + <longdescription lang="en"> + </longdescription> +</pkgmetadata> diff --git a/games-rpg/morrowind-data/morrowind-data-9999.ebuild b/games-rpg/morrowind-data/morrowind-data-9999.ebuild new file mode 100644 index 00000000..f2fe9a68 --- /dev/null +++ b/games-rpg/morrowind-data/morrowind-data-9999.ebuild @@ -0,0 +1,135 @@ +# By eroen <eroen-overlay@occam.eroen.eu>, 2016 +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# $Id$ + +EAPI=6 + +PYTHON_COMPAT=(python2_7 python3_3 python3_4 python3_5) +PYTHON_REQ_USE="ssl" +#CHECKREQS_DISK_BUILD="1140M" + +inherit eutils linux-info python-any-r1 + +DESCRIPTION="Data files for Morrowind" +HOMEPAGE="http://www.elderscrolls.com" +SRC_URI="https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" +LICENSE="all-rights-reserved Morrowind-EULA" +RESTRICT="bindist mirror" + +SLOT="0" +KEYWORDS="" # -* ~amd64 ~x86 +IUSE="" + +DEPEND="${PYTHON_DEPS} + sys-devel/gcc[cxx] + amd64? ( sys-devel/gcc[cxx,multilib] )" +RDEPEND="" + +STEAM_app_id=22320 # See https://steamdb.info +STEAM_platform=windows # linux, macos, or windows + +steam_pkg_setup() { + # CONFIG_PAX_ELFRELOCS must not be disabled (if present). + # Textrels are all over the place :( + if linux_config_exists; then + if [[ -n $(linux_chkconfig_string PAX_ELFRELOCS) ]] && \ + ! linux_chkconfig_present PAX_ELFRELOCS; then + die "Need support for x86 TEXTRELs" + fi + else + ewarn "Could not find kernel config. The install will fail later if" + ewarn "x86 TEXTRELs are not supported on the system." + fi + + : ${STEAM_CREDS:=/etc/portage/creds_steam} + if [[ $MERGE_TYPE != binary && ! -r $STEAM_CREDS ]]; then + die "\$STEAM_CREDS=$STEAM_CREDS is not readable" + fi + + if [[ -z $STEAM_app_id ]]; then + die "\$STEAM_app_id is not set" + fi + + python-any-r1_pkg_setup +} + +pkg_setup() { steam_pkg_setup; } + +steam_get_cred() { + [[ -n $1 ]] || die "$FUNCNAME - no argument passed" + awk "/^${1^^}: /{print \$2}" "$STEAM_CREDS" || die +} + +steam_get_mail() { + printf "%s\n%s\n%s\n" \ + "$(steam_get_cred MAIL_SERVER)" \ + "$(steam_get_cred MAIL_USER)" \ + "$(steam_get_cred MAIL_PASS)" \ + | ${EPYTHON} "$FILESDIR"/steam-mail.py +} + +esteamcmd() { + # Supply password on stdin to avoid leaking it in /proc/$pid/cmdline + printf "%s\n" "$(steam_get_cred STEAM_PASS)" \ + | ./steamcmd.sh \ + "+@ShutdownOnFailedCommand 1" \ + "+@NoPromptForPassword 0" \ + "+login $(steam_get_cred STEAM_USER)" \ + "$@" \ + "+quit" || die -n "Error $? in $FUNCNAME $*" +} + +steam_firstlogin() { + # make steam up to date + einfo "Update steam" + ./steamcmd.sh "+quit" || die "unable to run steamcmd.sh" + + # generate 'special access code' + einfo "Attempt to log in, generate special access code email" + printf "%s\n" "$(steam_get_cred STEAM_PASS)" \ + | ./steamcmd.sh "+login $(steam_get_cred STEAM_USER)" "+quit" + if [[ $? == 5 ]]; then + local i imax=5 + for (( i=1; i<=imax; i++ )); do + # supply 'special access code' + einfo "Supply special access code, attempt $i of $imax" + printf "%s\n" "$(steam_get_cred STEAM_PASS)" \ + | ./steamcmd.sh "+set_steam_guard_code $(steam_get_mail)" \ + "+login $(steam_get_cred STEAM_USER)" \ + "+quit" && break + + (( i < 5 )) || die "Unable to log in" + sleep 10 + done + fi + + # verify we can log in + einfo "Verify we can log in" + esteamcmd +} + +steam_src_unpack() { + default + steam_firstlogin + + local cmd_platform= + [[ -n $STEAM_platform ]] && cmd_platform="+@sSteamCmdForcePlatformType ${STEAM_platform}" + + # fetch our thing to $S + einfo "Install app_id ${STEAM_app_id}" + esteamcmd \ + "$cmd_platform" \ + "+force_install_dir ${S}" \ + "+app_update ${STEAM_app_id}" +} + +src_unpack() { steam_src_unpack; } + +src_install() { + insinto /usr/share/morrowind-data + doins -r "Data Files" + doins Morrowind.ini Journal.htm + dodoc Bethesda.TXT readme.txt +} |
