diff options
author | Daniel Santos (javamonger) <daniel.santos@pobox.com> | 2010-10-21 06:05:44 +0000 |
---|---|---|
committer | Daniel Santos (javamonger) <daniel.santos@pobox.com> | 2010-10-21 06:05:44 +0000 |
commit | 1457a9142f51bbc1657c70b74328dec6462ed2c2 (patch) | |
tree | c890ac61a1f2df8ec6d968c2b67112c8eff60cbd /games-strategy | |
parent | games-strategy/ moo2: New ebuild for bug #341859. (diff) | |
download | sunrise-1457a9142f51bbc1657c70b74328dec6462ed2c2.tar.gz sunrise-1457a9142f51bbc1657c70b74328dec6462ed2c2.tar.bz2 sunrise-1457a9142f51bbc1657c70b74328dec6462ed2c2.zip |
games-strategy/moo2: Added menu launcher, cleanup, formatting, comments and such.
svn path=/sunrise/; revision=11451
Diffstat (limited to 'games-strategy')
-rw-r--r-- | games-strategy/moo2/ChangeLog | 10 | ||||
-rw-r--r-- | games-strategy/moo2/Manifest | 11 | ||||
-rw-r--r-- | games-strategy/moo2/files/1.40.24/backup.sh | 81 | ||||
-rwxr-xr-x | games-strategy/moo2/files/1.40.24/moo2 | 63 | ||||
-rw-r--r-- | games-strategy/moo2/files/1.40.24/moo2rc | 16 | ||||
-rwxr-xr-x | games-strategy/moo2/files/1.40.24/utils.sh | 2 | ||||
-rw-r--r-- | games-strategy/moo2/moo2-1.40.24.ebuild | 50 |
7 files changed, 189 insertions, 44 deletions
diff --git a/games-strategy/moo2/ChangeLog b/games-strategy/moo2/ChangeLog index db2c957c2..0dbd06a19 100644 --- a/games-strategy/moo2/ChangeLog +++ b/games-strategy/moo2/ChangeLog @@ -2,6 +2,16 @@ # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 21 Oct 2010; Daniel Santos (dansan) <daniel.santos@pobox.com> + +files/1.40.24/backup.sh, moo2-1.40.24.ebuild, files/1.40.24/moo2, + files/1.40.24/moo2rc, files/1.40.24/utils.sh: + * Reformatted to 80 cols + * Changed license to GPL-2 MicroProse-EULA, repoman can deal + * Added icon & make_desktop_entry + * Added prepgamesdirs to the end of src_install() which I forgot earlier! + * Added functionality for the moo2 script to backup your saved games (I + had this earlier, but it wasn't working yet). + *moo2-1.40.24 (21 Oct 2010) 21 Oct 2010; Daniel Santos (dansan) <daniel.santos@pobox.com> diff --git a/games-strategy/moo2/Manifest b/games-strategy/moo2/Manifest index 6bcf49a4b..466facbe5 100644 --- a/games-strategy/moo2/Manifest +++ b/games-strategy/moo2/Manifest @@ -1,12 +1,13 @@ -AUX 1.40.24/moo2 5419 RMD160 e9b06a86128367bf663c42d33abf8daa6887ab8e SHA1 5c60b0dcebbc51241690f9033efe04145660baf5 SHA256 0dc33351a6ce0e996d80fe23eb4a21c4516bb504d8abc6f9258ad64a1bba7031 -AUX 1.40.24/moo2rc 570 RMD160 f6688234f8f056aed755cd33f74dcf18c366209e SHA1 3efabd165a33ba9297733f0b04c517f48896fb1c SHA256 36c10364aabf86f65207111e21c33e1a8190d5bc92ad8c646a732ebb49268db5 -AUX 1.40.24/utils.sh 2968 RMD160 eb27e65b49c4904354caffe851b325553ba7b381 SHA1 17bb9cfd873a68243ad58d2ad225b56036c93bd9 SHA256 e0d25478dcd13cc67e0787d383f91c46bfeebef7c1946233f776d3d56adeb095 +AUX 1.40.24/backup.sh 2367 RMD160 9da9d47ca272d56b1812e07deb62fe275fb3e5d5 SHA1 630b3e883c26ee134df9ba761850ee0858c7fc05 SHA256 c9082c4ef4dcfa8fec8c1c616250979cdf746600f87ef13a6645912e82dbebfe +AUX 1.40.24/moo2 6568 RMD160 5ca7df261be29f60e0e480a8bb21cfb0c0f77c43 SHA1 c62fcab8ebce058b830fc13cdba40bdbdf1ee0b0 SHA256 b01a236ca334f0c6d61844fb947c301818681502f2ef93065b7fffc9c8f71d4b +AUX 1.40.24/moo2rc 554 RMD160 48faddc7331359e8b570773af42376e599d0df0b SHA1 2d5279bf0f6138bb623f7c4188ff239399f3b9d9 SHA256 cca002d5db7441bd77cc5283a1887c8f24cf56b77554916421f9a8d9a42bcc0a +AUX 1.40.24/utils.sh 2955 RMD160 9b3a4e4b6289d60b7234571e392c340fda5bbd1f SHA1 c59607ee21906f2a4bc35a9900030a43ba16bd73 SHA256 ce36d479496c6dfa20d642e24f0e3028290447dd50b67dc61e21a06d12b96b63 AUX DIG.INI 207 RMD160 565def1d6423ca19de4723dc45698490352d6f29 SHA1 367e61fd8e4dbec2c8d05a77c5d20747a80e0a1f SHA256 26fa505f40f5fd67275d08d8d5b4cd6eafaebfe17c1736b21746560b490049b6 AUX MDI.INI 204 RMD160 53d1fd0216335575cf3f5bda288ff77e431ddf53 SHA1 14105c50c5a505f85164397453803523c6874bec SHA256 e6f5a679fd4edfd24c4c3d6b7331383cd13438f5d7d1416dc9c676652474712b AUX ORIONCD.INI 50 RMD160 58117d09aafeeb9d2625c7770702035c1d924e84 SHA1 11595b2e64bc5ea0c084224c913dc49366d956f9 SHA256 c35577d83cb314316d078b9957df8dbe88714fb242a4fa8f4fbfa1714d0c19b0 AUX installList.txt 961 RMD160 547a43e427b1ae70462e78ffeb1414362ff7d399 SHA1 c34cdd4842114317ec052888fe11e2977e45567a SHA256 828657f5c837c28d142d8863838d2d45bf63caa177344e3732651a5065c790d0 DIST Moo2v140b24.zip 21949 RMD160 246e2efef8b691055c4aac8ab4b09971704091c7 SHA1 19194bf840d394def506c2dfb5ddeabe4a25aa58 SHA256 725b95756f2c5bd284226e6552564e650b04f6a24ea5d049c4d903ae8420ce37 DIST moo2v131.zip 3429509 RMD160 a975e939e940df9d2144befeecfc160ae67356fa SHA1 d2e2d0cdc59a57afe76381ccb081fa8de6182e64 SHA256 60fff876ad0a68f7750972dda2195c16b04b28ea76db8ecf1f27dd19109f05b5 -EBUILD moo2-1.40.24.ebuild 3174 RMD160 a7eeebc3a30e903ddaa1e73a92b691090b571086 SHA1 6d8b9396f5e0bd09e342d394a47f26a79b5d5ae1 SHA256 d809ba1ef376e04fe135db49ae6ed37abc033ff426c5a9647e8ac935b82b5099 -MISC ChangeLog 431 RMD160 bf1ecfdfaf0128c85e22fd994f2b463cf9d9137e SHA1 e1e9f5dad4cbd13dc14612c999d8b5721cca36ca SHA256 0698ccc885950d9943dc7091a42c69833e7b45616ccb5a4fafc0f8529a5f052c +EBUILD moo2-1.40.24.ebuild 3488 RMD160 eef50653d7233f499619d076962a25099519b8fa SHA1 3a7f14db058c990f4d33b74a1f91c0d9a9b34fe2 SHA256 cc354d60168dedefd807aeee375dfe8de67e78683cb657282303a5b7bef170a0 +MISC ChangeLog 1106 RMD160 01164cb9d9a7e4b259a2278af4cd675bac10b2c5 SHA1 f2a1bc7f061b0e02a9bc5acf74a328625897b661 SHA256 e2edb51cf59fe5871bc92df73a2fe9608a541f9c3f01023b1fd990cf7efa6dcd MISC metadata.xml 436 RMD160 2ec95e07f53b5f39d67e038414515a03411412cb SHA1 40c17a958db403a24c7a1d46828eaed497817986 SHA256 8e5de5670266bf6316d3f63e42b09e9f8e18b203aa4c4d63120375143fb967e3 diff --git a/games-strategy/moo2/files/1.40.24/backup.sh b/games-strategy/moo2/files/1.40.24/backup.sh new file mode 100644 index 000000000..386f0f266 --- /dev/null +++ b/games-strategy/moo2/files/1.40.24/backup.sh @@ -0,0 +1,81 @@ +# backup.sh - Library of functions for backing up moo2 saved games +# Copyright (C) 2010 Daniel Santos <daniel.santos@pobox.com> +# $Header: $ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#set -o functrace +shopt -s extdebug + +############################################################################# +# Function : backupInit +# Arguments : none +# Description : +############################################################################# +backupInit() { + cd "${moo2UserDir}" || die + + # Check for good config + test -z "${backupBaseDir}" && die "backupBaseDir not set in ${configFile}" + + # Get absolute path + backupDir="${PWD}/${backupBaseDir}" + + # Make sure backupDir is usable or can be created. + getOrCreateUsableDir "${backupDir}" +} + +setFileName() { + backupBaseName="$1" + backupFileName="${backupDir}/${backupBaseName}.tgz" +} + +getFileName() { + setFileName "$1" + typeset -i firstTime=1 + while true; do + # Name can't be empty + if [[ ${#backupBaseName} -eq 0 ]]; then + + # Don't complain because not supplied at command line + if [[ ${firstTime} -eq 0 ]]; then + echo "Name cannot be empty, try again." + fi + + # Make sure it doesn't already exist + elif [[ -e "${backupFileName}" ]]; then + echo "File '${backupFileName}' already exists. Please choose another." + + else + return + fi + + echo "Please enter a name for this saved set." + echo -e "Saved set name: \c " + read + echo + setFileName "${REPLY}" + firstTime=0 + done +} + +# Do backup +doBackup() { + backupInit + getFileName "$1" + pushd "${moo2UserDir}/MPS/ORION2" 1>/dev/null || die "Failed to enter directory MPS/ORION!" + echo "Backing up to '${backupFileName}'..." + tar czf "${backupFileName}" $(ls SR_R[0-9]* HOF.* LASTRACE.RAC MOX.SET SAVE[0-9]*.GAM 2>/dev/null) || die + echo "Done!" + popd 1>/dev/null +} diff --git a/games-strategy/moo2/files/1.40.24/moo2 b/games-strategy/moo2/files/1.40.24/moo2 index 8f4880d4d..d40c31a01 100755 --- a/games-strategy/moo2/files/1.40.24/moo2 +++ b/games-strategy/moo2/files/1.40.24/moo2 @@ -19,9 +19,12 @@ moo2Dir="__MOO2DIR__" +. "${moo2Dir}/utils.sh" +. "${moo2Dir}/backup.sh" moo2UserDir="${HOME}/.moo2" configFile="${moo2UserDir}/moo2rc" -. "${moo2Dir}/utils.sh" +postRunMsg="" +postRunCmd="" ############################################################################# # Function : getSeed @@ -72,6 +75,7 @@ userInstall() { ln -s "${moo2Dir}/cd" . || die cp "${moo2Dir}/moo2rc" . || die + # DOS text management is a pain local userMsg="@echo \ Since this is your first time running Master of Orion II, we need to do some \ user-level setup. Master of Orion II uses dosbox. See the Welcome box above for\ @@ -99,7 +103,7 @@ help with that." pushd "${src}" || die # Some files cannot be read only and must be copied - cp -L SOUND.LBX SR_R* *.INI "${dest}" + cp -L SOUND.LBX SR_R* *.INI "${dest}" || die # All the rest can be read-only symlinks for f in *; do @@ -120,29 +124,28 @@ help with that." } ############################################################################# -# Function : main +# Function : verifyEnv # Arguments : none -# Description : Main function +# Description : Performs sanity checks: +# * Initates user install if needed +# * Corrects moo2exe if lordbrazen patch not installed +# * Warns if CD is not present ############################################################################# -main() { - local postRunMsg="" - local postRunCmd="" - +verifyEnv() { # If this is the 1st time to run, do user setup if [ ! -e "${moo2UserDir}/MPS/ORION2/ORION2.EXE" ]; then userInstall fi . "${configFile}" - # If we have the unofficial patch specified in the config, but not installed, use the offical - # version + # If we have the unofficial patch specified in the config, but not + # installed, use the offical version if [ ! -e "${moo2UserDir}/MPS/ORION2/M2V140.EXE" ]; then moo2exe=ORION2.EXE fi # Make sure the CD is still in if [ ! -e "${moo2UserDir}/cd/ORION2.EXE" ]; then - # DOS text management is a pain postRunMsg="\ You're Moo2 CD does not appear to be mounted. You can either put it in, \ reinstall with the nocd USE option (while the CD in) or change the symlink \ @@ -155,7 +158,14 @@ ${moo2UserDir}/cd." warn ${postRunMsg} echo fi +} +############################################################################# +# Function : runGame +# Arguments : none +# Description : (Attempts to) run the game. Function will not return. +############################################################################# +runGame() { # Run the game exec dosbox -conf "${moo2UserDir}/dosboxrc" \ -c "mount c ${moo2UserDir}" \ @@ -167,6 +177,35 @@ ${moo2UserDir}/cd." -c "exit" || warn "dosbox exited with error" } -main +showUsage() { + echo "USAGE: $0 [backup|restore [file_name]]" + exit +} + +############################################################################# +# Function : main +# Arguments : none +# Description : Main function +############################################################################# +main() { + verifyEnv + + # I should probably just make a separate script for this, but screw it. + if [[ "$1" == "backup" ]]; then + shift + (($# <= 1)) || showUsage + doBackup "$@" + elif [[ "$1" == "restore" ]]; then + shift + (($# <= 1)) || showUsage + echo "Restore not yet supported, but your backups are in" \ + "${moo2UserDir}/${backupBaseDir}" + else + (($#)) && showUsage + runGame + fi +} + +main "$@" # vim:ts=4
\ No newline at end of file diff --git a/games-strategy/moo2/files/1.40.24/moo2rc b/games-strategy/moo2/files/1.40.24/moo2rc index db61bcc84..ba1f6bc60 100644 --- a/games-strategy/moo2/files/1.40.24/moo2rc +++ b/games-strategy/moo2/files/1.40.24/moo2rc @@ -1,14 +1,14 @@ -# Base directory to backup saved games to, relative to moo2UserDir (usually ~/.moo2) -backupDirBase="saved-game-backups" +# Base directory to backup saved games to, relative to ${moo2UserDir}. +backupBaseDir="saved-game-backups" -# Which executable to run. M2V140.EXE is the unofficial, hacked-up executable and ORION2.EXE is -# the official one -moo2exe=M2V140.EXE +# Which executable to run. M2V140.EXE is the unofficial, hacked-up executable +# and ORION2.EXE is the official one. #moo2exe=ORION2.EXE +moo2exe=M2V140.EXE -# The arguments to pass. Do not add /seed, as this is randomly generated for you each time. See -# http://lordbrazen.blogspot.com/2005/01/moo2v140-patch-faq.html for a full list of command-line -# options +# The arguments to pass. Do not add /seed, as this is randomly generated for +# you each time. For a list of command-line options, see +# http://lordbrazen.blogspot.com/2005/01/moo2v140-patch-faq.html. #moo2args="/picks=10 /hugestart /planets=3 /skipintro /monsters=3" moo2args="/picks=10" diff --git a/games-strategy/moo2/files/1.40.24/utils.sh b/games-strategy/moo2/files/1.40.24/utils.sh index 621a5b326..bc0b90747 100755 --- a/games-strategy/moo2/files/1.40.24/utils.sh +++ b/games-strategy/moo2/files/1.40.24/utils.sh @@ -1,5 +1,3 @@ -#!/bin/bash - # utils.sh - Library of general utility functions # Copyright (C) 2010 Daniel Santos <daniel.santos@pobox.com> # $Header: $ diff --git a/games-strategy/moo2/moo2-1.40.24.ebuild b/games-strategy/moo2/moo2-1.40.24.ebuild index c1b9d546c..a6e41149e 100644 --- a/games-strategy/moo2/moo2-1.40.24.ebuild +++ b/games-strategy/moo2/moo2-1.40.24.ebuild @@ -14,12 +14,12 @@ HOMEPAGE="http://lordbrazen.blogspot.com" SRC_URI="ftp://ftp.infogrames.net/patches/moo2/${OFFICIAL_PATCH} lordbrazen? ( http://www.spheriumnorth.com/blog-images/${LB_PATCH} )" -LICENSE="EULA" +LICENSE="GPL-2 MicroProse-EULA" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="nocd lordbrazen" -DEPEND="" +DEPEND="|| ( media-gfx/graphicsmagick media-gfx/imagemagick )" RDEPEND="games-emulation/dosbox" GAMES_CHECK_LICENSE="yes" @@ -28,12 +28,14 @@ destDir="${GAMES_PREFIX_OPT}/${PN}" pkg_setup() { games_pkg_setup cdrom_get_cds ORION2.EXE - test -e "${CDROM_ROOT}/ORION2.EXE" || die "CD_ROOT does not point to the Master of Orion 2 CD" + test -e "${CDROM_ROOT}/ORION2.EXE" || + die "CD_ROOT does not point to the Master of Orion 2 CD" } src_unpack() { cd "${WORKDIR}" - sed "s:__MOO2DIR__:${destDir}:g" "${FILESDIR}/${PVR}/moo2" > moo2 || die "sed failed" + sed "s:__MOO2DIR__:${destDir}:g" "${FILESDIR}/${PVR}/moo2" > moo2 || + die "sed failed" # Copy CD or create symlink if use nocd; then @@ -49,27 +51,34 @@ src_unpack() { ln -s "${CDROM_ROOT}" "${WORKDIR}/cd" fi - # Now we're going to do everything that the normal DOS-based setup program does. + # Now we do everything that the normal DOS-based setup program does. mkdir -p MPS/ORION2 || die pushd MPS/ORION2 > /dev/null || die # If nocd is specified, we'll take care of this in src_install if ! use nocd; then - tar cC "${WORKDIR}/cd" $(cat "${FILESDIR}/installList.txt") | tar x || die + tar cC "${WORKDIR}/cd" $(cat "${FILESDIR}/installList.txt") | + tar x || die fi - # Apply official 1.31 patch (will overwrite some symlinks if USE=nocd, but that's OK). + # Apply official 1.31 patch (will overwrite some symlinks if USE=nocd, but + # that's OK). unpack ${OFFICIAL_PATCH} - # Install pre-configured .INI files (hardware is simulated, so it's all the same) + # Install pre-configured .INI files (hardware is simulated, so it's all the + # same) cp -L "${FILESDIR}/"*.INI . || die - # Add unofficial patch if use flag set, although it has to be run in dosbox, so it will actually - # run the first time the user lanuches the game. + # Add unofficial patch if use flag set, although it has to be run in dosbox, + # so it will actually run the first time the user lanuches the game. if use lordbrazen; then unpack ${LB_PATCH} || die fi popd > /dev/null + + # Convert m$ ico to png + convert "${WORKDIR}/cd/ORION2.ICO" "${WORKDIR}/${PN}.png" || + die "convert failed" } src_install() { @@ -77,15 +86,17 @@ src_install() { insinto "${destDir}" doins -r MPS || die "doins failed" - doins "${FILESDIR}/${PVR}/"{moo2rc,utils.sh} || die "doins failed" + doins "${FILESDIR}/${PVR}/"{moo2rc,utils.sh,backup.sh} || + die "doins failed" if use nocd; then # Copy the CD to disk doins -r cd || die "doins failed" - # If copying the entire CD to the hard drive anyway, we'll just use hard links to for the - # game install (what the DOS-based setup program normally does) except, of course, we wont - # overwrite files that have been replaced by a patch. + # If copying the entire CD to the hard drive anyway, we'll just use hard + # links to for the game install (what the DOS-based setup program + # normally does) except, of course, we wont overwrite files that have + # been replaced by a patch. for f in $(cat "${FILESDIR}/installList.txt"); do local src="${destDir}/cd/$f" local dest="${destDir}/MPS/ORION2/$f" @@ -94,11 +105,16 @@ src_install() { fi done else - # Create symlink to the CD. If the user has more than one CD-ROM drive or mount point, this - # can break later, but they can just re-install or fix it themselves. - ewarn "creating stupid link" "${CDROM_ROOT}" "${destDir}/cd" + # Create symlink to the CD. If the user has more than one CD-ROM drive + # or mount point, this can break later, but they can just re-install or + # fix it themselves. dosym "${CDROM_ROOT}" "${destDir}/cd" || die fi + + doicon "${WORKDIR}/${PN}.png" || die "doicon failed" + make_desktop_entry "${PN}" "Master of Orion II: Battle at Antares" || + die "make_desktop_entry failed" + prepgamesdirs } # vim:ts=4
\ No newline at end of file |