-
Notifications
You must be signed in to change notification settings - Fork 51
Linux Installation
I finally managed to lock TeamSpen in my basement, so he explain in detail how to launch postcompiler on linux. Yes it works on linux natively.
You can download linux build from github actions page. (You need to be sign in github to download it)
The secret is that you should launch it with the absolute path. Yes, not relative.
Example:
/home/user/Downloads/HammerAddons/postcompiler/postcompiler $path_to_map # RIGHT
./postcompiler $path_to_map # WRONG
Also you must set config file hammeraddons.vdf properly.
To generate config file just launch postcompiler once with any map path. One directory up hammeraddons.vdf will be generated. Move it to the "Portal 2" directory, and change this:
"game" "P2" // "P2CE" for Community Edition
"gamedir" "portal2/"
My method full of very dirty hacks and very unoptimized.
But it works, and even allow you to launch it from Hammer's F9 window.\
So we want to launch Linux application from Wine environment.
Fortunately for us WINE Is Not Emulator, so sandbox can be easily escaped, through start /unix <path>.
The problem is that hammer gives as path in Windows style, while we need them in Linux.
So we can just write the simple bash script that converts windows paths to linux.
#!/bin/bash
final_arg=""
for arg in $@
do
#echo $arg
if [[ $arg == "-"* ]]
then
final_arg="${final_arg} ${arg}"
else
final_arg="$final_argwinepath $arg"
fi
done
/home/user/Download/hammeraddons/postcompiler/postcompiler $final_arg # FULL ABSOLUTE PATH REQUIRED
This script will convert all arguments which does not start with "-".
Unfortunately for us /wait flag in combination with /unix does not working. So if we want to launch script from hammer properly, we need to improvise.
We cannot /wait linux process, but we can wait windows process.
So my solution is to make temporally file C:\ensure.file when postcompiler is finished, and continue compilation process only when we ensure, that this file exists.
For this we need to update our bash script and write .bat script.
BASH file /home/user/.wine/drive_c/launch_postcompiler.sh
#!/bin/bash
export WINEPREFIX=/home/max/.wine # Actually doesn't matter postcompiler cannot launch from non-default prefix in my experience.
rm $WINEPREFIX/drive_c/ensure.file # Check that file does not exist
final_arg=""
for arg in $@
do
#echo $arg
if [[ $arg == "-"* ]]
then
final_arg="${final_arg} ${arg}"
else
final_arg="$final_arg $( winepath $arg )"
fi
done
/home/max/Download/hammeraddons_post/postcompiler/postcompiler $final_arg
touch $WINEPREFIX/drive_c/ensure.file # Create file
BAT file /home/user/.wine/drive_c/start.bat
start /unix C:\launch_postcompiler.sh %*
@echo off
:loop
if EXIST C:\ensure.file (
del C:\ensure.file
) ELSE (
goto :loop
)
The just open F9 hammer and add executable C:\start.bat
(Hammer will not show it because it's not exe, so you need to enter it manually)
And this is how you can launch postcompiler from F9 window.
Also you WINEPREFIX should be default .wine.
And you should have drive which point to system root, because postcompiler want to drop some files into /tmp and use it in wine.
If you have suggestions feel free to say.