update generate_emu_config scripts to support Linux, it worked!

This commit is contained in:
ota 2023-12-16 09:53:41 +02:00 committed by otavepto
parent 4a7fedecd0
commit 01b8259200
4 changed files with 121 additions and 52 deletions

29
scripts/rebuild_linux.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
venv=".env-linux"
out_dir="bin/linux"
build_temp_dir="build_tmp-linux"
tool_name="generate_emu_config"
main_file="generate_emu_config.py"
[[ -d "$out_dir" ]] && rm -r -f "$out_dir"
mkdir -p "$out_dir"
[[ -d "$build_temp_dir" ]] && rm -r -f "$build_temp_dir"
rm -f *.spec
chmod 777 "./$venv/bin/activate"
source "./$venv/bin/activate"
pyinstaller "$main_file" --distpath "$out_dir" -y --clean --onedir --name "$tool_name" --noupx --console -i "NONE" --workpath "$build_temp_dir" --collect-submodules "steam" || exit 1
cp -f "steam_default_icon_locked.jpg" "$out_dir/$tool_name"
cp -f "steam_default_icon_unlocked.jpg" "$out_dir/$tool_name"
echo;
echo =============
echo Built inside: "$out_dir/"
deactivate

View File

@ -1,37 +1,44 @@
@echo off
setlocal
pushd "%~dp0"
set "venv=.env"
set "out_dir=bin"
set "build_temp_dir=build_tmp"
set "tool_name=generate_emu_config"
set "icon_file=icon\Froyoshark-Enkel-Steam.ico"
set "main_file=generate_emu_config.py"
if exist "%out_dir%" (
rmdir /s /q "%out_dir%"
)
if exist "%build_temp_dir%" (
rmdir /s /q "%build_temp_dir%"
)
del /f /q "*.spec"
call "%venv%\Scripts\activate.bat"
pyinstaller "%main_file%" --distpath "%out_dir%" -y --clean --onedir --name "%tool_name%" --noupx --console -i "%icon_file%" --workpath "%build_temp_dir%" --collect-submodules "steam"
copy /y "steam_default_icon_locked.jpg" "%out_dir%\%tool_name%\"
copy /y "steam_default_icon_unlocked.jpg" "%out_dir%\%tool_name%\"
echo:
echo =============
echo Built inside : "%out_dir%\"
:script_end
popd
endlocal
@echo off
setlocal
pushd "%~dp0"
set "venv=.env-win"
set "out_dir=bin\win"
set "build_temp_dir=build_tmp-win"
set "tool_name=generate_emu_config"
set "icon_file=icon\Froyoshark-Enkel-Steam.ico"
set "main_file=generate_emu_config.py"
set /a last_code=0
if exist "%out_dir%" (
rmdir /s /q "%out_dir%"
)
mkdir "%out_dir%"
if exist "%build_temp_dir%" (
rmdir /s /q "%build_temp_dir%"
)
del /f /q "*.spec"
call "%venv%\Scripts\activate.bat"
pyinstaller "%main_file%" --distpath "%out_dir%" -y --clean --onedir --name "%tool_name%" --noupx --console -i "%icon_file%" --workpath "%build_temp_dir%" --collect-submodules "steam" || (
set /a last_code=1
goto :script_end
)
copy /y "steam_default_icon_locked.jpg" "%out_dir%\%tool_name%\"
copy /y "steam_default_icon_unlocked.jpg" "%out_dir%\%tool_name%\"
echo:
echo =============
echo Built inside: "%out_dir%\"
:script_end
popd
endlocal & (
exit /b %last_code%
)

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root" >&2
exit 1
fi
venv=".env-linux"
reqs_file="requirements.txt"
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
apt update || exit 1
apt install "python3.10" -y || exit 1
apt install "python3.10-venv" -y || exit 1
[[ -d "$script_dir/$venv" ]] && rm -r -f "$script_dir/$venv"
python3.10 -m venv "$script_dir/$venv" || exit 1
sleep 1
chmod 777 "$script_dir/$venv/bin/activate"
source "$script_dir/$venv/bin/activate"
pip install -r "$script_dir/$reqs_file"
exit_code=$?
deactivate
exit $exit_code

View File

@ -1,15 +1,19 @@
@echo off
cd /d "%~dp0"
set "venv=.env"
set "reqs_file=requirements.txt"
if exist "%venv%" (
rmdir /s /q "%venv%"
)
python -m venv "%venv%"
timeout /t 1 /nobreak
call "%venv%\Scripts\activate.bat"
pip install -r "%reqs_file%"
@echo off
cd /d "%~dp0"
set "venv=.env-win"
set "reqs_file=requirements.txt"
if exist "%venv%" (
rmdir /s /q "%venv%"
)
python -m venv "%venv%" || exit /b 1
timeout /t 1 /nobreak
call "%venv%\Scripts\activate.bat"
pip install -r "%reqs_file%"
set /a exit_code=errorlevel
call "%venv%\Scripts\deactivate.bat"
exit /b %exit_code%