install_from_cd_goty.sh: New script that uses rewise by CYBERDEViL instead of Wine

This commit is contained in:
Marco Cawthorne 2023-05-08 11:14:18 -07:00
parent b96929cddf
commit 6dd45060c2
Signed by: eukara
GPG key ID: CE2032F0A2882A22
2 changed files with 183 additions and 122 deletions

202
install_from_cd_goty.sh Executable file → Normal file
View file

@ -1,137 +1,95 @@
#!/bin/sh
# I mean... this sucks, I get it - but sadly we have to use Wine for this
# because no one has made an installer extractor for Wine that works on
# Linux. Sorry.
# all new script that dumps the Half-Life: Game of the Year edition
# data onto your hard disk. make sure you have the CD-ROM inserted!
# builds a pk3 file that's alphabetically sorted
mk_pk3()
{
tree -fi > ./build_contents.txt
sed -i '/build_contents/d' ./build_contents.txt
sed -i '/directories,/d' ./build_contents.txt
zip -0 "$1".pk3 -@ < ./build_contents.txt
rm ./build_contents.txt
mv "$1".pk3 ../"$1".pk3
}
# pass HLDIR to tell it where to put the Half-Life files to.
# e.g. HLDIR=/tmp/Half-Life
# otherwise, it'll put it into the parent dir, of the working directory.
SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )"
OUTPK3DIR="pak01_retail.pk3dir"
# pass TMPDIR to tell it where to put temporary install files to.
# e.g. TMPDIR=/tmp/gotycd
# otherwise, it'll put it into the current working directory.
if ! [ -x "$(command -v wine)" ]; then
printf "Error: wine is not installed.\n" >&2
exit 1
set -e
SETUP_SHA256="3b2b35e27aa7c54bedd39dd0074193dfcba9a3054623e93fc29f8f71779b082b"
TMPDIR="$(pwd)/tmp"
# allow user override
if [ -z "$CDROM_PATH" ]
then
CDROM_PATH="/mnt/cdrom"
SETUP_FILE="$CDROM_PATH/setup.exe"
fi
if [ -z "$HLDIR" ]
then
HLDIR="$(pwd)/.."
fi
if [ -z "$TMPDIR" ]
then
TMPDIR="$(pwd)/tmp"
fi
if ! [ $# -gt 0 ]; then
printf "Path to MOUNTED CD-ROM folder, e.g. /mnt/cdrom:\n"
read CDROM_PATH
if [ "$1" = "-h" ]
then
printf "%s help\n\n" "$(basename $0)"
printf "pass HLDIR to tell it where to put the Half-Life files to.\n"
printf "e.g. HLDIR=/tmp/Half-Life.\n"
printf "otherwise, it'll put it into the parent dir, of the working directory\n\n"
printf "pass TMPDIR to tell it where to put temporary install files to.\n"
printf "e.g. TMPDIR=/tmp/gotycd.\n"
printf "otherwise, it'll put it into the current working directory.\n\n"
printf "HLDIR will require at least 356M disk space.\n"
printf "TMPDIR will require at least 462M disk space.\n"
exit 0
fi
if [ ! -x "$(command -v rewise)" ]
then
printf "rewise is not present. please build it and place it in PATH.\n"
printf "src: https://notabug.org/CYBERDEViL/REWise\n"
exit 2
fi
if [ ! -f "$SETUP_FILE" ]
then
printf "Please mount the Game of the Year edition CD-ROM.\n"
exit 2
fi
if [ -x "$(command -v sha256sum)" ]
then
CHECK=$(sha256sum "$SETUP_FILE" | awk '{ print $1 }')
elif [ -x "$(command -v sha256)" ]
then
CHECK=$(sha256 -q "$SETUP_FILE")
else
CDROM_PATH="$1"
printf "No tool to validate sha256 sums with!\n"
exit 2
fi
if ! [ -f "$CDROM_PATH"/setup.exe ]; then
printf "Error: install.EXE not found in $CDROM_PATH.\n" >&2
exit 1
if [ ! "$CHECK" = "$SETUP_SHA256" ]
then
printf "%s checksum mismatch.\n" "$SETUP_FILE"
exit 2
fi
# Set up a prefix that's 32-bit inside
export WINEPREFIX="${SCRPATH}/prefix"
export WINEARCH=win32
DATA_PATH="${WINEPREFIX}/drive_c/Sierra/Half-Life/"
# No pak0 present
if ! [ -f "$SCRPATH/pak0_cd.pk3" ]; then
# Check if we need to install the content, or throw a warning.
if ! [ -f "$SCRPATH/$OUTPK3DIR/liblist.gam" ]; then
# May already have been extracted here (debug)
if ! [ -f "$DATA_PATH"/hl.exe ]; then
# Because /x does NOT preserve directories.
wine "$CDROM_PATH"/setup.exe /s
fi
# Transplant the pak0.pak out of the data dir
if ! [ -f "$SCRPATH/pak00_cd.pak" ]; then
mv "$DATA_PATH/valve/pak0.pak" "$SCRPATH/pak00_cd.pak"
fi
# Move valve to become OUTPK3DIR
mv "$DATA_PATH/valve" "$SCRPATH/$OUTPK3DIR"
# Logos need to be in the game-dir
mv "$DATA_PATH/logos" "$SCRPATH/$OUTPK3DIR/logos"
else
printf "$OUTPK3DIR already exists... everything okay?\n"
fi
# Make the pk3 archive
cd "$SCRPATH/$OUTPK3DIR"
mk_pk3 pak01_cd
if [ -d "$TMPDIR" ]
then
rm -rf "$TMPDIR"
fi
# Make sure we're back in here
cd "$SCRPATH"
mkdir -p "$TMPDIR"
rewise -x "$TMPDIR" "$SETUP_FILE" &> /dev/null
# check if we need an icon.tga
if ! [ -f "$SCRPATH/icon.tga" ]; then
# imagemagick will help us get our icon
if [ -x "$(command -v convert)" ]; then
printf "Detected ImageMagick's convert... giving you a nice icon!\n"
convert "$DATA_PATH/valve.ico" "$SCRPATH/valve.tga"
rm "$SCRPATH/valve-0.tga"
rm "$SCRPATH/valve-1.tga"
rm "$SCRPATH/valve-3.tga"
mv "$SCRPATH/valve-2.tga" "$SCRPATH/icon.tga"
else
printf "No ImageMagick found... can't give you a window icon then.\n"
fi
fi
# Make sure we're back in here
cd "$SCRPATH"
printf "All done. Would you like to rip the the Compact Disc Digital Audio for music?\ny/n: "
read CHOICE
if [[ "$CHOICE" == [Yy]* ]]; then
# check if we require rippin tunes
if ! [ -f "$SCRPATH/music/track02.wav" ] && ! [ -f "$SCRPATH/music/track02.ogg" ]; then
if [ -x "$(command -v cdparanoia)" ]; then
mkdir -p "./music"
cd "./music"
cdparanoia -B
rename ".cdda." "." *.wav
# Maybe the user does not have the physical disc and cdp fails.
if [ -f "$SCRPATH/music/track02.wav" ]; then
# I'd offer FLAC, but that also requires the ffmpeg plugin
if [ -x "$(command -v oggenc)" ]; then
printf "All done. Would you like to convert them to OGG for playback compatibility\nas well as space preservation (frees up ~330 MB)?\ny/n: "
read CHOICE
if [[ "$CHOICE" == [Yy]* ]]; then
oggenc *.wav
rm *.wav
fi
fi
fi
else
printf "cdparanoia is missing. Cannot rip music.\nPlease run the installer again once you've got it installed.\n"
fi
else
printf "Music was already present.\n"
fi
fi
cd "$SCRPATH"
# Grab patches, GOTY is at 1.1.0.6
grab_patch()
{
wget -nc -O ./pak$2.pk4 http://archive.org/download/hl_shareware_data/valve/$1.zip
}
grab_patch 11071108 14_1108
grab_patch 11081109 15_1109
grab_patch 11091110 16_1110
# Be real careful here
rm -rfv "./$OUTPK3DIR"
rm -rfv "./prefix"
# traverse the tmpdir, move files into the output location
while read LINE
do
FILE=$(printf "$LINE" | awk '{ print $2 }')
TMPFILE="$TMPDIR/MAINDIR/$FILE"
mkdir -p "$HLDIR/$(dirname $FILE)"
cp "$TMPFILE" "$HLDIR/$FILE"
done < "install_from_cd_goty.sha256"

103
install_from_cd_goty.sha256 Normal file
View file

@ -0,0 +1,103 @@
4d86a3362c721e0e63a1a5426e65d001945ad910e4450ca281c72c2eb3835b14 valve/gfx/shell/cb_checked.bmp
3733d610783c5bb34e00063746452037de0ac169ba9de932bfea59b351c3e4b2 valve/gfx/shell/cb_disabled.bmp
5c6ec4c93db93690bcb1df918569afea0171cc276a26f6ffa32d77e8c07cd46b valve/gfx/shell/cb_down.bmp
e7ab820798e6a0a93a7b9c3e82d192b5a20740495d18e7f4c634a57e7342d938 valve/gfx/shell/cb_empty.bmp
7647a8ec321f65fc937bf2cd2d772c6f9c4fbbb06aac62bf0b1dfb0aa9b60978 valve/gfx/shell/cb_over.bmp
f0c864ce1549d0530b8a0b5a6b9d62fee8ee507004dd7dd6fe97c070d5a58687 valve/gfx/shell/cls_d.bmp
41d9c63adfa1ed4071b91969ce3c02dc49fe5c6c3d2b4dad62283e57e1c7153e valve/gfx/shell/cls_f.bmp
637052253efb9d8ee007550419f9ff3f22ee29242d1f5e6e2d02afdd7a836c62 valve/gfx/shell/cls_n.bmp
f2c0923674e31c03d77f6687d8237f0c6e7b429c39b92cac5c46dd91297f6091 valve/gfx/shell/Colors.lst
d2bc816cdea1c1dc4a1786cde28e191a89c93ef3127c64400017903356fa1f1a valve/gfx/shell/dedicate.bmp
0b1de714c26bf1b1eef29c79996ab2acb6857cc76ba057f4a649baf32604dff4 valve/gfx/shell/dnarrowd.bmp
c07158f47c21faea540f003a5e81245e10c53df768bd3d9f4fc6f48f12707bed valve/gfx/shell/dnarrowf.bmp
cb22c16041c8194bec6afbeb19a55778ead6ab204a6b37c2b5b961436de762de valve/gfx/shell/dnarrowp.bmp
486279aa9f8af9987bde2b11e4000535304e784bd5ffdec2f5701afbe2ec4420 valve/gfx/shell/down.bmp
1d6dbe71ac9cc99a51a8d2fe00b1fbe42b11fbae5202b460a6592172a82f9058 valve/gfx/shell/favorite.bmp
b1e9f6b602109815fe398b45d4b6d6d479f53bd693ef88be27a98861932ff649 valve/gfx/shell/kb_keys.lst
f318d94070fa71ce4b8e6dee3c6913ab55db8d60b1cedeeb30449742e424a448 valve/gfx/shell/larrowdefault.bmp
83eebb65a6b2154ef373cb294363a3fcd2d68a5cde92e81fc445f075463a7627 valve/gfx/shell/larrowflyover.bmp
a63070cd328b3a5080578eaaea957d71aea24ed636d978e0ed70f442973a9969 valve/gfx/shell/larrowpressed.bmp
d204fabc1c3551bf67df38c8e5a31348d849262e7c67cd5bcd8d56dccb4004d2 valve/gfx/shell/linux.bmp
fbebef999e158ea5169825193ee5dc584caee5f609bd6ec447ea8fe49261f18a valve/gfx/shell/listen.bmp
0fc66cbb649d0ebc3ea3933aa9db40b28f334cf831ec7e76e2c10bf5ca6827fc valve/gfx/shell/lock.bmp
e931c1448be432e20a32b02a61a54ad6af829d3530379dd6baa2a4a2712ea8d0 valve/gfx/shell/min_d.bmp
6a41babaaf746a51ebd4544365f4a93ad209d41d301ed0306b8a212efd4fc983 valve/gfx/shell/min_f.bmp
40c068d930dfb672abfc91c7bd843acaec705d00604f3985db5401272a48e7da valve/gfx/shell/min_n.bmp
ab79f35bb12d7350a78f53929a7a05c87a6fd2e02b02d219b2c4b83a464b842b valve/gfx/shell/nonfav.bmp
54fb2ec5692d5d8447c96d6a70eb86058aba853d77bd7586fe024ae081feffe9 valve/gfx/shell/pcg.bmp
cc2c5f55d07faa26bd4ea55d5b5430f6797447bfeb372727d25888ebd7e42623 valve/gfx/shell/rarrowdefault.bmp
bf8c3bfb1bce4a51f1935769891f2ab314eecbbabc175711a349d70e6f2eb85e valve/gfx/shell/rarrowflyover.bmp
107542508bde0517ab1752cd6d0620656f8cc89f3f106b157dceb5d77b98949b valve/gfx/shell/rarrowpressed.bmp
daff5568f611fc027fc3fa82f64dc6c39fcd78d68381a8ae0740207d297c2852 valve/gfx/shell/slider.bmp
c59ec9ce1c81049386024358148f0296cb3d7e77968cf95c075bcbf36040b168 valve/gfx/shell/sm_dnarf.bmp
13a05e5260cd7ccaa62e1f70dbc73c591d7586affe7be8021907dbcae52d59e0 valve/gfx/shell/sm_dnarw.bmp
1ed59029bcbfa703af000dd8277746ad876218d37d8f99a2fc39866c6d4262d5 valve/gfx/shell/thumb.bmp
bcf5ed86e9d724e1601cb06e5bd8b027f9e215c42610b865e8101676c877a431 valve/gfx/shell/unlock.bmp
15473ef64c4dbcd3650ab2416dacde36afc8680de40ca2589562580cd7834f40 valve/gfx/shell/up.bmp
1482d4dadf5025de843eb0186771fcac3ee469cf7b01df51c82038ed44658334 valve/gfx/shell/uparrowd.bmp
7c15f1e4e9b405c173c6515e982815d5d31e142414bf2bd63d0c714a9ef2599b valve/gfx/shell/uparrowf.bmp
d6456543c2bcd2f408a218e4d2a034430b7ab6c9cdf2fa0f5866f4eca2289fe0 valve/gfx/shell/uparrowp.bmp
ba236c88bf2927f8582be9a587dbb51908a484fd88ef51b1200f4f1f2705cead valve/gfx/shell/windows.bmp
ba48340d3cd52d785b04505848b458bb81d5264eb41c23420c20ecf16cb597fc valve/gfx/shell/btns_main.bmp
080795bb1c4cdb225f1d49e0c9ce9e598c7141a0aa8726324c8a17f4720d6aae valve/gfx/shell/head_advoptions.bmp
aed37bc448e2128d35c21264352d59ece99c524a992260eb13fe3c15a1fdf9b2 valve/gfx/shell/head_custom.bmp
8ea4cdb4636392a31fd1fabb9ff4d1e2c0a64270867c898bbaf88f12b42dcc4d valve/gfx/shell/kb_act.lst
1a09320c1bec4d1ec2c7bceb9b481494a72651c5b01f292fa25439b999893583 valve/gfx/shell/kb_def.lst
5768afa6d5852d71d2551319ee8a62200592e9ae5e2a62dc4d921da2a23b7cd9 valve/gfx/vgui/mouse.tga
96d9fb3d9ac5201d0ad134e487994e9a8645c4e76299b018b437b7bb268fafa3 valve/models/player/barney/barney.bmp
8bba02d6801db546259e8ee20847a4d3e96f2a1d60fa043f26ec9d3224bf6bea valve/models/player/barney/barney.mdl
3c246c9b1d0c187b733c25c617eed8e9e6bf16820dea612a3e7305a045a291f4 valve/models/player/gman/gman.BMP
3870ed2fd72487c0c34490f97c2b358454be78efd2549002bb762189d9fc965a valve/models/player/gman/Gman.mdl
f8f6058119a63f7829aaf8a4e7438a47bdd98a4cafea9333bd60470709ffc532 valve/models/player/hgrunt/hgrunt.bmp
5fee8caae9095361aa534cc6f6b0f2895c9da2387fc6edbc6a3fbaf9e1007057 valve/models/player/hgrunt/Hgrunt.mdl
c11f8a98985c4691254b03c2fdbdc875c3331a071828d4d39cfa27d8fbf8a4fd valve/models/player/recon/recon.bmp
76e20d4bea5867280333995805f08b494b0aa7e116db316746df771b6621cb94 valve/models/player/recon/recon.mdl
bea7d0ee672e6356ef62d6027474dd27fc03696e9d6bea82e48a7e326e88286c valve/models/player/robo/Robo.bmp
c929fd09db1075194e4644acc0ed41a4278eba12f86cc24d1f8fc29d0b90bec1 valve/models/player/robo/robo.mdl
08865ba940e8fa88df5fa2232fa17d229131b2e1791d785ea7fbcacee14ee15d valve/models/player/zombie/zombie.bmp
a73009e66baf727ff4fecf715a36d36567a8cea633207f343d0792a8ba2b27e0 valve/models/player/zombie/zombie.mdl
bd8cc2e5f111735bc3e1a051f97075d9a1804c8e98692e3a868857e95e23a232 valve/liblist.gam
efce3f5735ffb05ccf493c980bd61b774e43ce37ec12c0402d43400e07a6743e valve/mapcycle.txt
cd36d358e0a0ab5f654816a0e3d606e1267aa6014ff9f11462b3b4ede5f59487 valve/profile.lst
521849d70e2a7927e119e8c1fd438f4d43a80a68f447b4f1e85a01eea4f6b734 valve/rooms.lst
837091d76e885116a38949012bbbc99d2a5d46438586e76c6983c3a02a21d008 valve/settings.scr
0c47a50f4970a65b05914cb758e6f47f9f0d45a7e7d85076aef94a1d48d80d92 valve/titles.txt
1a5071189aa2596d488e3801c63b1e742cddd1f49da0f06c30643f40b641d020 valve/user.scr
5b1b2dd68c2ff1fc6cda3f415cfa7087884ca075c371574aa19c1e4474c4d540 valve/valve.rc
6222243e0839022f3041e6b9e97776ce54d0cf87d4c3810e627b8b2815b555f5 valve/maps/crossfire.bsp
752abc65a1bef9755efe9b0177f932cd9d617a59bffd43aed330076ca5c7f5cc valve/maps/frenzy.bsp
c96d75b16d8507dc996c49294aeda8bb7d5279a5930576aa5b6494e89d07f9bc valve/maps/rapidcore.bsp
3a8178df0cda00bf44bf7982ac5f260ba4335bc661da83a06ee99faa379f530b valve/media/launch_deny1.wav
98e2d0a6c5a8c0adf9f75bdbe627b433d36d2d9c26a7b7843fe8ea892b6d7356 valve/media/launch_deny2.wav
4bbc4680030a300fc535279ab08362e5b5ded8189065f852b3b78052ddfd11bf valve/media/launch_dnmenu1.wav
5140ee43c6ba8cfab956c405f22f4ec989f427305d5b921be115b2c789451b3f valve/media/launch_glow1.wav
894ef53ebfaad82a3b2c900b4d2eff5ba4e8fdf1ee339cdbb2e82f6e614fb1df valve/media/launch_select1.wav
bb580215824dd89825f114f4fbe5514f0e9783a1ca7bb7aed2376fadc349b6aa valve/media/launch_select2.wav
913ead8450ba2e23c2b10aad5bf29ba923f21fb1ba58943044081a7938ddf915 valve/media/launch_upmenu1.wav
89eea4b29e3c5272a688e1a42db8a17f6b878c805ffea467edb1e5ad03b47f3d valve/media/logo.avi
f3429e06124e28f6a69e6ef6bcb89d22103612158de6a0f8348725be1e9ea4b3 valve/media/sierra.avi
4ce170dfa11f980075f8b6a8a85c3cf78eb59f8766a26b721bff0910ad3baf2d valve/media/valve.avi
a03140547f462ff1e593ed91b29c34ba712f348f866bc8947bdd05bc84e61f6c valve/pak0.pak
ccd07f0ddf0226f3207d4f36603ff4065b0e798e0dfcf4ff69c24aec0d2ee91a valve/sprites/hud.txt
7c6d3b5719cadce1f5ea55df021c4e5941c55d550e0686bb03a5ac78f0c350bc valve/sprites/shellchrome.spr
b9ac3a6c455fa54a11d4f00f8248909800b8b19f84e84bb35e826e4c137f262d valve/cached.wad
17726e8174729011c7ea4e1e37b4ccfe7a9aa4abb82c2aaca87872cbe0c106d0 valve/decals.wad
d6989bb9fc90c437f9957cc7bceb8f2550b38b8791df679753b7c08c98632b80 valve/fonts.wad
6fd53d6ef8d704299734018e3069ec12551e7fb2065804a1d4e5c936ac4033bd valve/gfx.wad
38ababf773463fdf6133005d13e543098fc42392b458057f239469b764691300 valve/halflife.wad
0f5c3ae49af4e72f4f26752c1fd5dfbea8f88859f1097badf8733fa6093a8f95 valve/liquids.wad
bff7ad40b9b6ff446d56cf3fd05fd2e50c8d8d186dade45549e3313680815e82 valve/spraypaint.wad
d63e152db6d950f671356c4da0d8a1966e0d940a2166b61678e3a6d46644cd7c valve/xeno.wad
9f5a3aa0b49609b6461593f2d1af0e7deb6e2c6883a114487a96c7b61b0fced8 logos/8ball1.bmp
f35918394959002e44919b9b4c090630e0dd807154a8dd8b28896f13c88faf4a logos/andre.bmp
49a9549f6ef5b5c578609a5f291119b97571e669db4fb2b7d22b6a8a23ec1143 logos/camp1.bmp
30540cce8c36b0cd8b2f5d0790288c82175096d0236d24f47c8b6a591385cf41 logos/chick1.bmp
88bc2cd2dac6482c37132b691e2039dc793da95a1e7a548210682b56b52374c2 logos/chuckskull.bmp
a03bb48e4599c5c1d15554119db31622a53bb9989e5b51d27f835ff70b40dcc8 logos/devl1.bmp
93ad5c9ac6af96dca019c59b2832c3d90b9db7ee7615a6d1d93d260f8f3ae240 logos/gun1.bmp
1af36b03a2df6da208575c6a54fa8244f7c7ab8c1ad4b1d2208ef0c28e94715d logos/lambda.bmp
b8471cb9c6a85760cfbf29b814a168a37532e98e125485c3357dff31cfe8bd42 logos/skull.bmp
fed3427703ddee0a8e0ec08e645eaf039f97d4e42c3a48241ae1791188ad00ec logos/smiley.bmp
1734d46ebe96c82da9107db988727f78218f7f7d417a268d4dca38941dc7852f logos/splatt.bmp
555eb2ffe4789715c488a5b1298cbddbe807619a58201afd0f3e10074744cc33 logos/tiki.bmp
81cf60e1eed45acb0160374a78f0398e5005e5328e071b4692dcfdbd3175a65b logos/v_1.bmp