Version bump for Warcraft 3, install script adapted for patching and installing the expansion

This commit is contained in:
grepwood@sucs.org 2020-03-29 14:32:34 +02:00
parent ab5ed0fbae
commit 89b7c62f1b
6 changed files with 258 additions and 103 deletions

View File

@ -1,6 +1,2 @@
AUX install_wc3_linux.sh 2842 BLAKE2B bb2512f37eff9caa6bcf74aee7ca6c14960070909580fd792bac80894485bce11ba16732ee82131f7e5ffe387a7566ca0215a2136ef267a5d0b7c0201956b62d SHA512 cc42b335a9a9b43b272f659646d38555e74ebaa1913ea115ccea1147cabaf710089d8aca111f524eac07ea7eb18398cdc0a5262d775b65934287c6ba91677c48
AUX warcraft3 465 BLAKE2B 1a759e7adc9fecbefb0f1da81c0d72d743433813896ba5288c621936f5c2f086842e36c015fd7873232287f019e123abb6aacba5ce518542a3c2d742342cb4a0 SHA512 c9a2d7c6fab6fe81513d6598c39b8191bb3ef17db9647a88b02f11511d03e304842328c8ccb1f1db8c70323ce7372c7b70cd157093b0ce1b72d31c86dc68d172
AUX warcraft3.desktop 137 BLAKE2B 7a20014483906327a566b58c14915cd83804327aa1f666855e354ad78a4eccc233b2d9753e4b79f3aa6a01bbcf69bfaebd9dbd3e159b6c81d857e25bcc295bd4 SHA512 819ed9aad584c1e278be33a861067a899088e71b1b4ed6c01b68670f617d746df2eb57056a93adc60cdee563ea212a5a6ef01cbc51245898d3ed6ec637cc4453
AUX warcraft3_worldedit 470 BLAKE2B 6da8ac771cfe9949566a50f478c83ff134c16f6f62d507f88bb0a9dbebd85772f1962da31bc4ae76f2c8c1caba066c9a0ef2e99a011355f35f33831d27ab66ac SHA512 4c453e2646a5c2d647c86e69ff88c6e33d78f17ff0f6e1375a74b998364bd431dd0c9131a45501b0ceca84c67036a98fdcf925f93a304398987a289dfbe243ec
AUX warcraft3_worldedit.desktop 156 BLAKE2B 78905fe58229db4a0e118aa1575ee55e2924250cba47b5f25f261b6322dd555cbd0506f3a56afa2699cdc8ccdddd3f7cbb857d522480c29b0a7066a8669cdc48 SHA512 9f80697f8930d01823e796492fdbdb3b02dcd7c7d4a3127979e0257958daac084e1295addf2ca96a31cf569c6c29e4c01ad6508605bd63b3b7ba520dfcac286f
EBUILD warcraft3-1.0.ebuild 2004 BLAKE2B 40b0bf193b870c26cc8e3871594b0594ccacdbe776a060d4be6ea4832f9c1965048392c194ad70d41e90728c8e6953e2aa0e3f5cb9958830c21e06dde9b7e781 SHA512 408f78a52e029f683d24764e06d98fa75640859655b547f98b844be98ae384a30f1b7c2a530a5e05dc4de664f208c496accc71cbf5a183edb40660657ccc1b68
DIST War3ROC_126a_English.exe 18484644 BLAKE2B c126ad1dedb9dd58dae149619fa0576a62ca114ceb4aa3f55ce50d88671a45b15dd2bc2bbf53f81b25c9884004c0cf1f34c75adbc7fb64221fb17cb972c91a2e SHA512 74b76dd35a0587cc3aee02a2adc26dcb9b8ac2ed57cc0e6438cd08f519c7c2ae35148fb29db12e9c8b382ba37f69e3e9851fe8faeab2d4a758baee64ef611a97
DIST War3TFT_126a_English.exe 58718061 BLAKE2B 1b25a8add352ca18eb1bcde2752267e12891e143e4ad8d0c291ce0f04f3827516b75035f6b25ddb11574306c82335bef33ce7a88b8e652b94f9f6d96e0ef13f9 SHA512 10a3f8dd3c77869ce1d8c29d43e9974aa60285af80e53728700c9358c61b58dfe204ba94fc0b4808c93221d14d7e619dd791beed0444ce138d28aa13522f6a14

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -xeuo pipefail
set -eu
wine_window_stage1=""
wine_window_stage2=""
@ -20,31 +20,60 @@ XAUTHORITY=$(pwd)/xauth
DISPLAY=""
function list_wine_windows {
xdotool search --class wine
local array=""
set +eu
while [ "${array}" = "" ]; do
sleep 5
array=($(xdotool search --class wine))
done
set -eu
echo ${array[@]}
}
function last_wine_window {
for((counter=0, limit=$(($# - 1)); counter < limit; counter++)); do
shift
local array=($@)
echo ${array[$((${#array[@]}-1))]}
}
function initialize_openbox {
xvfb-run -a -f ${XAUTHORITY} openbox --sync &
while [ "${DISPLAY}" = "" ]; do
DISPLAY=$(ps aux | awk '{if($1 == "'$(whoami)'") print $0}' | grep Xvfb\ :[0-9]* | grep -v grep | grep -o Xvfb\ :[0-9]* | awk '{print $2}')
done
echo $1
}
function start_installer {
xvfb-run -a -f ${XAUTHORITY} openbox --sync --startup ${WORKDIR}/run_installer_in_openbox.sh &
sleep 120
DISPLAY=$(ps aux | awk '{if($1 == "'$(whoami)'") print $0}' | grep Xvfb\ :[0-9]* | grep -v grep | grep -o Xvfb\ :[0-9]* | awk '{print $2}')
function create_wine_prefix {
wine systeminfo
}
function main {
start_installer
function start_roc_installer {
initialize_openbox
create_wine_prefix
pushd ${WAR3ROC_CDROM_ROOT}
wine install.exe &
popd
}
function start_tft_installer {
pushd ${WAR3TFT_CDROM_ROOT}
wine install.exe &
popd
}
function begin_install {
wine_window_stage1=($(list_wine_windows))
installer_window=$(last_wine_window ${wine_window_stage1[@]})
# Initiate installation
xdotool windowactivate --sync ${installer_window} key W
}
function accept_eula {
wine_window_stage2=($(list_wine_windows))
eula_window=$(last_wine_window ${wine_window_stage2[@]})
xdotool windowactivate --sync ${eula_window} key A
}
function pass_roc_cdkey_prompt {
wine_window_stage3=($(list_wine_windows))
cdkey_window=$(last_wine_window ${wine_window_stage3[@]})
# Input Gentoo as the owner
@ -53,18 +82,39 @@ function main {
done
xdotool windowactivate --sync ${cdkey_window} key Tab
# Input CDKEY
for (( i=0; i<${#CDKEY}; i++ )); do
if [ "${CDKEY:$i:1}" != "-" ]; then
xdotool windowactivate --sync ${cdkey_window} key ${CDKEY:$i:1}
for (( i=0; i<${#WAR3ROC_CDKEY}; i++ )); do
if [ "${WAR3ROC_CDKEY:$i:1}" != "-" ]; then
xdotool windowactivate --sync ${cdkey_window} key ${WAR3ROC_CDKEY:$i:1}
fi
done
xdotool windowactivate --sync ${cdkey_window} key Tab
xdotool windowactivate --sync ${cdkey_window} key KP_Enter
}
function pass_tft_cdkey_prompt {
wine_window_stage3=($(list_wine_windows))
cdkey_window=$(last_wine_window ${wine_window_stage3[@]})
# Input CDKEY
for (( i=0; i<${#WAR3TFT_CDKEY}; i++ )); do
if [ "${WAR3TFT_CDKEY:$i:1}" != "-" ]; then
xdotool windowactivate --sync ${cdkey_window} key ${WAR3TFT_CDKEY:$i:1}
fi
done
xdotool windowactivate --sync ${cdkey_window} key Tab
xdotool windowactivate --sync ${cdkey_window} key KP_Enter
}
function input_location {
# Input location
wine_window_stage4=($(list_wine_windows))
location_window=$(last_wine_window ${wine_window_stage4[@]})
set +e
xdotool windowactivate --sync ${location_window} key KP_Enter
xdotool windowactivate --sync ${location_window} key KP_Enter
set -e
}
function wait_through_installation {
# Wait through installation
wine_window_stage5=($(list_wine_windows))
installation_window=$(last_wine_window ${wine_window_stage5[@]})
@ -72,18 +122,99 @@ function main {
sleep 5
done
sleep 5
}
function pass_shortcut_phase {
# No shortcut please
wine_window_stage6=($(list_wine_windows))
shortcut_window=$(last_wine_window ${wine_window_stage6[@]})
xdotool windowactivate --sync ${shortcut_window} key Tab
xdotool windowactivate --sync ${shortcut_window} key KP_Enter
}
function pass_registration_phase {
# No registration please
wine_window_stage7=($(list_wine_windows))
registration_window=$(last_wine_window ${wine_window_stage7[@]})
xdotool windowactivate --sync ${registration_window} key Tab
xdotool windowactivate --sync ${registration_window} key KP_Enter
}
function exit_from_installer {
# Exit from installer
xdotool windowactivate --sync ${installer_window} key X
xdotool windowclose ${installer_window}
set +e
while [ $(ps aux | awk '{if($1 == "'$(whoami)'") print $0}' | grep \\.exe | grep -vc grep) -gt 0 ]; do
ps aux | awk '{if($1 == "'$(whoami)'") print $0}' | grep \\.exe | grep -v grep | awk '{print $2}' | xargs kill -15
sleep 15
done
set -e
# rm -f ${XAUTHORITY}
}
function start_patcher {
set -x
if [ ${TFT} -eq 1 ]; then
wine ${DISTDIR}/War3TFT_126a_English.exe &
else
wine ${DISTDIR}/War3ROC_126a_English.exe &
fi
}
function wait_for_patch_dialog {
local array=($(list_wine_windows))
local limit=3
if [ ${TFT} -eq 1 ]; then
limit=4
fi
while [ ${#array[@]} -ne ${limit} ]; do
sleep 1
array=($(list_wine_windows))
done
while [ $(ls ${WINEPREFIX}/drive_c/Program\ Files/Warcraft\ III | grep ^PTC.*\\.tmp$ -c) -ne 0 ]; do
sleep 1
done
}
function close_patcher {
local wine_windows=($(list_wine_windows))
local patcher_window=$(last_wine_window ${wine_windows[@]})
xdotool windowclose ${patcher_window}
}
function close_xvfb {
set +e
while [ $(ps aux | awk '{if($1 == "'$(whoami)'") print $0}' | grep openbox | grep -vc grep) -gt 0 ]; do
ps aux | awk '{if($1 == "'$(whoami)'") print $0}' | grep openbox | grep -v grep | awk '{print $2}' | xargs kill -15
sleep 15
done
set -e
}
function main {
start_roc_installer
begin_install
accept_eula
pass_roc_cdkey_prompt
input_location
wait_through_installation
pass_shortcut_phase
exit_from_installer
if [ ${TFT} -eq 1 ]; then
start_tft_installer
begin_install
accept_eula
pass_tft_cdkey_prompt
wait_through_installation
pass_shortcut_phase
exit_from_installer
fi
if [ ${PATCH} -eq 1 ]; then
start_patcher
wait_for_patch_dialog
close_patcher
fi
close_xvfb
}
main $@

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -xeuo pipefail
set -euo pipefail
IFS=$'\n\t'
export WC3_DATA_DIR="/usr/share/games/warcraft3"
@ -14,10 +14,11 @@ if [ ! -d ~/.local/share/Warcraft3 ]; then
done
mkdir replay
mkdir save
mkdir Errors
popd
fi
pushd ~/.local/share/Warcraft3
winetricks quartz
wine War3.exe
winetricks quartz
wine war3.exe
popd

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -xeuo pipefail
set -euo pipefail
IFS=$'\n\t'
export WC3_DATA_DIR="/usr/share/games/warcraft3"
@ -14,10 +14,11 @@ if [ ! -d ~/.local/share/Warcraft3 ]; then
done
mkdir replay
mkdir save
mkdir Errors
popd
fi
pushd ~/.local/share/Warcraft3
winetricks quartz
wine WorldEdit.exe
winetricks quartz
wine worldedit.exe
popd

View File

@ -1,76 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION=""
HOMEPAGE=""
LICENSE="Warcraft3_EULA"
SLOT="0"
KEYWORDS="~amd64 ~x86"
BDEPEND="
sys-apps/sed
sys-apps/coreutils
sys-apps/grep
sys-apps/gawk
sys-process/procps
media-gfx/icoutils
media-gfx/imagemagick
x11-misc/xvfb-run
x11-wm/openbox"
RDEPEND="
app-emulation/wine-vanilla[abi_x86_32]
app-emulation/winetricks
app-shells/bash"
DEPEND="${RDEPEND}"
S=${WORKDIR}
src_unpack() {
if [ -z ${CDKEY} ] || [ -z ${CDROM_ROOT} ]; then
eerror "Missing CDKEY and CDROM_ROOT environment variables. Without them, Warcraft 3 cannot be installed."
exit
fi
export WINEPREFIX="$(pwd)/wineprefix"
export WINEARCH="win32"
export WINEDEBUG="-all"
export HID_DEVICES=($(ls /dev | grep ^hid | sed 's_^_/dev/_'))
einfo "Adding temporary pseudo rw to /dev/input"
addpredict /dev/input
for hid_device in ${HID_DEVICES[@]}; do
einfo "Adding temporary pseudo rw to ${hid_device}"
addpredict ${hid_device}
done
cat <<EOF > run_installer_in_openbox.sh
#!/usr/bin/env bash
set -euo pipefail
cd ${CDROM_ROOT}
wine install.exe &
EOF
chmod +x run_installer_in_openbox.sh
CDKEY=${CDKEY} CDROM_ROOT=${CDROM_ROOT} ${FILESDIR}/install_wc3_linux.sh
mv ${WINEPREFIX}/drive_c/Program\ Files/Warcraft\ III warcraft3
wrestool -x -t14 -n WAR3.ICO -o . warcraft3/War3.exe
wrestool -x -t14 -n WORLDEDIT_ICON -o . warcraft3/WorldEdit.exe
convert War3.exe_14_WAR3.ICO_0.ico warcraft3.png
convert WorldEdit.exe_14_WORLDEDIT_ICON.ico warcraft3_worldedit.png
mv warcraft3-8.png warcraft3.png
mv warcraft3_worldedit-8.png warcraft3_worldedit.png
}
src_install() {
insinto /usr/share/games
doins -r warcraft3
insinto /usr/share/pixmaps
doins warcraft3.png
doins warcraft3_worldedit.png
insinto /usr/share/applications
doins "${FILESDIR}/warcraft3.desktop"
doins "${FILESDIR}/warcraft3_worldedit.desktop"
dobin "${FILESDIR}/warcraft3"
dobin "${FILESDIR}/warcraft3_worldedit"
}

View File

@ -0,0 +1,102 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION=""
HOMEPAGE=""
LICENSE="Warcraft3_EULA"
SLOT="0"
KEYWORDS="~amd64 ~x86"
SRC_URI="https://archive.org/download/wc3_patches/Windows/ROC/English/War3ROC_126a_English.exe https://archive.org/download/wc3_patches/Windows/TFT/English/War3TFT_126a_English.exe"
IUSE="tft video_cards_nouveau"
BDEPEND="
sys-apps/sed
sys-apps/coreutils
sys-apps/grep
sys-apps/gawk
sys-process/procps
media-gfx/icoutils
media-gfx/imagemagick
x11-misc/xvfb-run
x11-misc/xdotool
x11-wm/openbox"
RDEPEND="
app-emulation/wine-vanilla[abi_x86_32,gstreamer]
media-plugins/gst-plugins-meta[ffmpeg]
media-video/ffmpeg[mp3,xvid]
app-emulation/winetricks
app-shells/bash"
DEPEND="${RDEPEND}"
S=${WORKDIR}
src_unpack() {
if [ -z ${WAR3ROC_CDKEY} ] || [ -z ${WAR3ROC_CDROM_ROOT} ]; then
eerror "Missing WAR3ROC_CDKEY and WAR3ROC_CDROM_ROOT environment variables. Without them, Warcraft 3 cannot be installed."
die
fi
if use tft ; then
if [ -z ${WAR3TFT_CDKEY} ] || [ -z ${WAR3TFT_CDROM_ROOT} ]; then
eerror "Missing WAR3TFT_CDKEY and WAR3TFT_CDROM_ROOT environment variables. Without them, The Frozen Throne expansion cannot be installed."
die
fi
fi
if use video_cards_nouveau ; then
einfo "This USE flag has no effect just yet. This is a placeholder for https://gitlab.com/src_prepare/src_prepare-overlay/-/issues/2"
fi
export WINEPREFIX="$(pwd)/wineprefix"
export WINEARCH="win32"
export WINEDEBUG="-all"
export HID_DEVICES=($(ls /dev | grep ^hid | sed 's_^_/dev/_'))
export PATCH=1
export TFT=0
if use tft ; then
TFT=1
fi
einfo "Adding temporary pseudo rw to /dev/input"
addpredict /dev/input
for hid_device in ${HID_DEVICES[@]}; do
einfo "Adding temporary pseudo rw to ${hid_device}"
addpredict ${hid_device}
done
if use tft ; then
eerror "The Frozen Throne is not supported yet."
die
fi
${FILESDIR}/install_wc3_linux.sh
einfo "Installation finished."
# Everything ready, time to prepare for src_install
mv ${WINEPREFIX}/drive_c/Program\ Files/Warcraft\ III warcraft3
wrestool -x -t14 -n WAR3.ICO -o . warcraft3/war3.exe
wrestool -x -t14 -n WORLDEDIT_ICON_2_MAP -o . warcraft3/worldedit.exe
convert war3.exe_14_WAR3.ICO_0.ico warcraft3.png
convert worldedit.exe_14_WORLDEDIT_ICON_2_MAP.ico warcraft3_worldedit.png
mv warcraft3-8.png warcraft3.png
mv warcraft3_worldedit-8.png warcraft3_worldedit.png
if use tft ; then
einfo "Stub: TFT parts here"
fi
}
src_install() {
insinto /usr/share/games
doins -r warcraft3
insinto /usr/share/pixmaps
doins warcraft3.png
doins warcraft3_worldedit.png
insinto /usr/share/applications
doins "${FILESDIR}/warcraft3.desktop"
doins "${FILESDIR}/warcraft3_worldedit.desktop"
dobin "${FILESDIR}/warcraft3"
dobin "${FILESDIR}/warcraft3_worldedit"
if use tft ; then
einfo "Stub: TFT parts here"
fi
}