Portability fixes, tested on OpenBSD.
This commit is contained in:
parent
258bbf496f
commit
5eb2d3fa3b
|
@ -26,8 +26,17 @@ find_file ()
|
|||
|
||||
find "./_tmp" -type f -name "${SEARCHNAME}" | while read FOUND
|
||||
do
|
||||
CHECK=$(sha256sum "${FOUND}" | cut -d ' ' -f 1)
|
||||
#echo "$CHECK == $2"
|
||||
# GNU vs non GNU
|
||||
if [ -x "$(command -v sha512sum)" ]
|
||||
then
|
||||
CHECK=$(sha256sum "$FOUND" | awk '{ print $1 }')
|
||||
elif [ -x "$(command -v sha512)" ]
|
||||
then
|
||||
CHECK=$(sha256 -q "$FOUND")
|
||||
else
|
||||
echo "No tool to validate sha256 sums with!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "${CHECK}" = "$2" ]
|
||||
then
|
||||
|
|
|
@ -18,21 +18,28 @@ then
|
|||
fi
|
||||
|
||||
PAK0_OUTDIR="$(pwd)/_build/halflife/$1-pak0"
|
||||
FINAL_TEST=$(cat "sums/$1_pak0.sha512" | cut -d ' ' -f 1)
|
||||
FINAL_TEST=$(cat "sums/$1_pak0.sha512" | awk '{ print $1 }')
|
||||
|
||||
find_file ()
|
||||
{
|
||||
SEARCHNAME=$(basename "${1}")
|
||||
|
||||
#echo "Looking for $SEARCHNAME"
|
||||
|
||||
if [ ! -z "$HL_STEAM_INSTALL" ]
|
||||
then
|
||||
find "$HL_STEAM_INSTALL" -type f -name "${SEARCHNAME}" | while read FOUND
|
||||
do
|
||||
CHECK=$(sha256sum "${FOUND}" | cut -d ' ' -f 1)
|
||||
#echo "$CHECK == $2"
|
||||
|
||||
# GNU vs non GNU
|
||||
if [ -x "$(command -v sha512sum)" ]
|
||||
then
|
||||
CHECK=$(sha256sum "$FOUND" | awk '{ print $1 }')
|
||||
elif [ -x "$(command -v sha512)" ]
|
||||
then
|
||||
CHECK=$(sha256 -q "$FOUND")
|
||||
else
|
||||
echo "No tool to validate sha256 sums with!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "${CHECK}" = "$2" ]
|
||||
then
|
||||
mkdir -p "${PAK0_OUTDIR}/$(dirname $1)"
|
||||
|
@ -49,8 +56,17 @@ find_file ()
|
|||
|
||||
find "./_tmp" -type f -name "${SEARCHNAME}" | while read FOUND
|
||||
do
|
||||
CHECK=$(sha256sum "${FOUND}" | cut -d ' ' -f 1)
|
||||
#echo "$CHECK == $2"
|
||||
# GNU vs non GNU
|
||||
if [ -x "$(command -v sha512sum)" ]
|
||||
then
|
||||
CHECK=$(sha256sum "$FOUND" | awk '{ print $1 }')
|
||||
elif [ -x "$(command -v sha512)" ]
|
||||
then
|
||||
CHECK=$(sha256 -q "$FOUND")
|
||||
else
|
||||
echo "No tool to validate sha256 sums with!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "${CHECK}" = "$2" ]
|
||||
then
|
||||
|
@ -92,7 +108,17 @@ cp -v "games/$1.dat" "$PAK0_OUTDIR/src/files.dat"
|
|||
cd "$PAK0_OUTDIR/src/"
|
||||
qfiles -pak 0
|
||||
|
||||
FINAL_CHECK=$(sha512sum "$PAK0_OUTDIR/pak0.pak" | cut -d ' ' -f 1)
|
||||
# GNU vs non GNU
|
||||
if [ -x "$(command -v sha512sum)" ]
|
||||
then
|
||||
FINAL_CHECK=$(sha512sum "$PAK0_OUTDIR/pak0.pak" | awk '{ print $1 }')
|
||||
elif [ -x "$(command -v sha512)" ]
|
||||
then
|
||||
FINAL_CHECK=$(sha512 -q "$PAK0_OUTDIR/pak0.pak")
|
||||
else
|
||||
echo "No tool to validate sha512 sums with!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Desired SHA512: ${FINAL_TEST}"
|
||||
echo "Generated SHA512: ${FINAL_CHECK}"
|
||||
|
|
|
@ -2,6 +2,27 @@
|
|||
|
||||
set -e
|
||||
|
||||
MAKEVER=$(make --version | awk '{ print $1 }' | head -n 1)
|
||||
|
||||
# is this GNU?
|
||||
if [ "$MAKEVER" = "GNU" ]
|
||||
then
|
||||
MAKETOOL="make"
|
||||
else
|
||||
# guess not, do we have gmake?
|
||||
if [ -x "$(command -v gmake)" ]
|
||||
then
|
||||
MAKEVER=$(gmake --version | awk '{ print $1 }' | head -n 1)
|
||||
if [ "$MAKEVER" = "GNU" ]
|
||||
then
|
||||
MAKETOOL="gmake"
|
||||
else
|
||||
echo "Please install GNU Make."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
DEPSDIR="$(pwd)/_deps"
|
||||
BINDIR="$(pwd)/_bin"
|
||||
INCTOOLDIR="$(pwd)/tools"
|
||||
|
@ -20,23 +41,23 @@ mkdir "$DEPSDIR"
|
|||
mkdir "$BINDIR"
|
||||
cd "$DEPSDIR"
|
||||
|
||||
git clone https://notabug.org/CYBERDEViL/REWise
|
||||
git clone https://vcs.vera-visions.com/eukara/REWise
|
||||
cd REWise
|
||||
make
|
||||
$MAKETOOL CC=cc
|
||||
mv -v rewise "$BINDIR/rewise"
|
||||
|
||||
cd "$DEPSDIR"
|
||||
git clone https://github.com/RavuAlHemio/hllib
|
||||
cd hllib/HLLib
|
||||
make
|
||||
git clone https://vcs.vera-visions.com/eukara/HLLib
|
||||
cd HLLib/HLLib
|
||||
$MAKETOOL CC=cc CXX=c++
|
||||
cd ../HLExtract
|
||||
make
|
||||
$MAKETOOL CC=cc CXX=c++
|
||||
mv -v hlextract "$BINDIR/hlextract"
|
||||
|
||||
cd "$DEPSDIR"
|
||||
git clone https://github.com/yquake2/pakextract
|
||||
cd pakextract
|
||||
make CC=cc
|
||||
$MAKETOOL CC=cc
|
||||
mv -v pakextract "$BINDIR/pakextract"
|
||||
|
||||
cd "$INCTOOLDIR/bmpfix"
|
||||
|
|
|
@ -6,7 +6,7 @@ set -e
|
|||
fetch_resource()
|
||||
{
|
||||
BASENAME=$(basename "$1")
|
||||
SHA512FILE=$(cat "./sums/$BASENAME.sha512")
|
||||
SHA512FILE=$(cat "./sums/$BASENAME.sha512" | awk '{ print $1 }')
|
||||
|
||||
if [ ! -f "$BASENAME" ]
|
||||
then
|
||||
|
@ -15,7 +15,17 @@ fetch_resource()
|
|||
printf "\n"
|
||||
fi
|
||||
|
||||
SHA512SUM=$(sha512sum "$BASENAME")
|
||||
# GNU vs non GNU
|
||||
if [ -x "$(command -v sha512sum)" ]
|
||||
then
|
||||
SHA512SUM=$(sha512sum "$BASENAME" | awk '{ print $1 }')
|
||||
elif [ -x "$(command -v sha512)" ]
|
||||
then
|
||||
SHA512SUM=$(sha512 -q "$BASENAME")
|
||||
else
|
||||
echo "No tool to validate sha512 sums with!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$SHA512SUM" = "$SHA512FILE" ]
|
||||
then
|
||||
|
|
|
@ -13,12 +13,6 @@ x_rewise()
|
|||
rewise -x "./_tmp/$1" "$1"
|
||||
}
|
||||
|
||||
sz_extract()
|
||||
{
|
||||
7z x "$1"
|
||||
}
|
||||
|
||||
|
||||
# clean up
|
||||
if [ -d "./_tmp" ]
|
||||
then
|
||||
|
@ -31,8 +25,9 @@ x_rewise "hluplink.exe"
|
|||
x_rewise "hl1110.exe"
|
||||
x_rewise "opfordemofull.exe"
|
||||
x_rewise "hl_sdk_v23.exe"
|
||||
x_rewise "of1108.exe"
|
||||
x_rewise "steaminstall_halflife.exe"
|
||||
#x_rewise "steaminstall_opfor.exe"
|
||||
x_rewise "steaminstall_opfor.exe"
|
||||
|
||||
mkdir -p "./_tmp/hluplink-pak0"
|
||||
pakextract -o "./_tmp/hluplink-pak0" "./_tmp/hluplink.exe/MAINDIR/valve/pak0.PAK"
|
||||
|
@ -40,19 +35,22 @@ pakextract -o "./_tmp/hluplink-pak0" "./_tmp/hluplink.exe/MAINDIR/valve/pak0.PAK
|
|||
mkdir -p "./_tmp/opfordemofull-pak0"
|
||||
pakextract -o "./_tmp/opfordemofull-pak0" "./_tmp/opfordemofull.exe/MAINDIR/valve/pak0.PAK"
|
||||
|
||||
mkdir -p "./_tmp/opfordemofull-gbpak0"
|
||||
pakextract -o "./_tmp/opfordemofull-gbpak0" "./_tmp/opfordemofull.exe/MAINDIR/gearbox/pak0.PAK"
|
||||
|
||||
mkdir -p "./_tmp/half-life.gcf"
|
||||
hlextract -p "./_tmp/steaminstall_halflife.exe/MAINDIR/SteamApps/half-life.gcf" -d "./_tmp/half-life.gcf" -e "root/valve/"
|
||||
|
||||
#mkdir -p "./_tmp/opposing force.gcf"
|
||||
#hlextract -p "./_tmp/steaminstall_opfor.exe/MAINDIR/SteamApps/opposing force.gcf" -d "./_tmp/opposing force.gcf" -e "root/gearbox/"
|
||||
mkdir -p "./_tmp/opposing force.gcf"
|
||||
hlextract -p "./_tmp/steaminstall_opfor.exe/MAINDIR/SteamApps/opposing force.gcf" -d "./_tmp/opposing force.gcf" -e "root/gearbox/"
|
||||
|
||||
./ccase.sh -r "./_tmp"
|
||||
|
||||
# if anything goes wrong here, it's probably imagemagick messing with the image
|
||||
if [ ! -x "$(command -v magick)" ]; then
|
||||
convert "./_tmp/hluplink-pak0/gfx/shell/btns_main.bmp" -compress none -crop 156x4836+0+0 BMP3:"./_tmp/btns_main.bmp"
|
||||
else
|
||||
magick "./_tmp/hluplink-pak0/gfx/shell/btns_main.bmp" -compress none -crop 156x4836+0+0 BMP3:"./_tmp/btns_main.bmp"
|
||||
fi
|
||||
convert "./_tmp/hluplink-pak0/gfx/shell/btns_main.bmp" -compress none -crop 156x4836+0+0 BMP3:"./_tmp/hluplink-pak0/btns_main.bmp"
|
||||
convert "./_tmp/of1108.exe/maindir/gearbox/gfx/shell/btns_main.bmp" -compress none -crop 156x5382+0+0 BMP3:"./_tmp/of1108.exe/btns_main.bmp"
|
||||
|
||||
bmpfix "./_tmp/hl1110.exe/maindir/valve/models/player/hgrunt/hgrunt.bmp"
|
||||
bmpfix "./_tmp/hl1110.exe/maindir/valve/models/player/hgrunt/hgrunt.bmp"
|
||||
|
||||
sed -i '/slot6,/d' "./_tmp/opfordemofull-pak0/gfx/shell/kb_act.lst"
|
||||
sed -i '/slot7,/d' "./_tmp/opfordemofull-pak0/gfx/shell/kb_act.lst"
|
23
start.sh
23
start.sh
|
@ -2,24 +2,35 @@
|
|||
set -e
|
||||
|
||||
# some sanity checks before we continue
|
||||
if [ ! -x "$(command -v make)" ]; then
|
||||
if [ ! -x "$(command -v make)" ]
|
||||
then
|
||||
echo "make not found. Please install GNU make."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v cc)" ]; then
|
||||
if [ ! -x "$(command -v cc)" ]
|
||||
then
|
||||
echo "cc not found. Please install a C compiler."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v wget)" ]; then
|
||||
if [ ! -x "$(command -v wget)" ]
|
||||
then
|
||||
echo "wget not found. Please install wget."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v magick)" ]; then
|
||||
if [ ! -x "$(command -v convert)" ]; then
|
||||
echo "magick/convert not found. Please install ImageMagick."
|
||||
if [ ! -x "$(command -v convert)" ]
|
||||
then
|
||||
echo "magick/convert not found. Please install ImageMagick."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v sha512sum)" ]
|
||||
then
|
||||
if [ ! -x "$(command -v sha512)" ]
|
||||
then
|
||||
echo "sha512 or sha512sum not found."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue