Skip to content

Commit 0e608a5

Browse files
authored
Add GUI Support for OpCore Simplify (#512)
* Refactor OpCore-Simplify to GUI version * New ConfigEditor * Add requirement checks and installation in launchers * Add GitHub Actions workflow to generate manifest.json * Set compression level for asset * Skip .git and __pycache__ folders * Refactor update process to include integrity checker * Add SMBIOS model selection * Update README.md * Update to main branch
1 parent 871d826 commit 0e608a5

38 files changed

Lines changed: 4947 additions & 1635 deletions
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Generate Manifest
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '.gitattributes'
7+
- '.gitignore'
8+
- 'LICENSE'
9+
- 'README.md'
10+
workflow_dispatch:
11+
release:
12+
types: [published]
13+
14+
jobs:
15+
generate-manifest:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.13'
26+
27+
- name: Generate manifest.json
28+
run: |
29+
python3 << 'EOF'
30+
import os
31+
import sys
32+
33+
from Scripts import integrity_checker
34+
from Scripts import utils
35+
36+
checker = integrity_checker.IntegrityChecker()
37+
38+
root_folder = os.getcwd()
39+
manifest_path = os.path.join(root_folder, "manifest.json")
40+
41+
print(f"Generating manifest from: {root_folder}")
42+
manifest_data = checker.generate_folder_manifest(root_folder, manifest_path)
43+
44+
if manifest_data:
45+
print(f"Manifest generated successfully with {len(manifest_data)} files")
46+
else:
47+
print("Failed to generate manifest")
48+
sys.exit(1)
49+
EOF
50+
51+
- name: Upload manifest.json to Artifacts
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: manifest.json
55+
path: ./manifest.json
56+
if-no-files-found: error
57+
compression-level: 0

OpCore-Simplify.bat

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,56 @@ if /i "!just_installing!" == "TRUE" (
299299
)
300300
exit /b
301301

302+
:checkrequirements
303+
REM Check and install Python requirements
304+
set "requirements_file=!thisDir!requirements.txt"
305+
if not exist "!requirements_file!" (
306+
echo Warning: requirements.txt not found. Skipping dependency check.
307+
exit /b 0
308+
)
309+
echo Checking Python dependencies...
310+
"!pypath!" -m pip --version > nul 2>&1
311+
set "pip_check_error=!ERRORLEVEL!"
312+
if not "!pip_check_error!" == "0" (
313+
echo Warning: pip is not available. Attempting to install pip...
314+
"!pypath!" -m ensurepip --upgrade > nul 2>&1
315+
set "ensurepip_error=!ERRORLEVEL!"
316+
if not "!ensurepip_error!" == "0" (
317+
echo Error: Could not install pip. Please install pip manually.
318+
exit /b 1
319+
)
320+
)
321+
REM Try to import key packages to check if they're installed
322+
"!pypath!" -c "import PyQt6; import qfluentwidgets" > nul 2>&1
323+
set "import_check_error=!ERRORLEVEL!"
324+
if not "!import_check_error!" == "0" (
325+
echo Installing required packages from requirements.txt...
326+
"!pypath!" -m pip install --upgrade -r "!requirements_file!"
327+
set "pip_install_error=!ERRORLEVEL!"
328+
if not "!pip_install_error!" == "0" (
329+
echo.
330+
echo Error: Failed to install requirements. Please install them manually:
331+
echo !pypath! -m pip install -r !requirements_file!
332+
echo.
333+
echo Press [enter] to exit...
334+
pause > nul
335+
exit /b 1
336+
)
337+
echo Requirements installed successfully.
338+
) else (
339+
echo All requirements are already installed.
340+
)
341+
exit /b 0
342+
302343
:runscript
303344
REM Python found
304345
cls
346+
REM Check and install requirements before running the script
347+
call :checkrequirements
348+
set "req_check_error=!ERRORLEVEL!"
349+
if not "!req_check_error!" == "0" (
350+
exit /b 1
351+
)
305352
set "args=%*"
306353
set "args=!args:"=!"
307354
if "!args!"=="" (

OpCore-Simplify.command

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,42 @@ prompt_and_download() {
283283
done
284284
}
285285

286+
check_and_install_requirements() {
287+
local python="$1"
288+
local requirements_file="$dir/requirements.txt"
289+
290+
# Check if requirements.txt exists
291+
if [ ! -f "$requirements_file" ]; then
292+
echo "Warning: requirements.txt not found. Skipping dependency check."
293+
return 0
294+
fi
295+
296+
# Check if pip is available
297+
if ! "$python" -m pip --version > /dev/null 2>&1; then
298+
echo "Warning: pip is not available. Attempting to install pip..."
299+
if ! "$python" -m ensurepip --upgrade > /dev/null 2>&1; then
300+
echo "Error: Could not install pip. Please install pip manually."
301+
return 1
302+
fi
303+
fi
304+
305+
# Check if requirements are installed by trying to import key packages
306+
echo "Checking Python dependencies..."
307+
if ! "$python" -c "import PyQt6; import qfluentwidgets" > /dev/null 2>&1; then
308+
echo "Installing required packages from requirements.txt..."
309+
if ! "$python" -m pip install --upgrade -r "$requirements_file"; then
310+
echo "Error: Failed to install requirements. Please install them manually:"
311+
echo " $python -m pip install -r $requirements_file"
312+
return 1
313+
fi
314+
echo "Requirements installed successfully."
315+
else
316+
echo "All requirements are already installed."
317+
fi
318+
319+
return 0
320+
}
321+
286322
main() {
287323
local python= version=
288324
# Verify our target exists
@@ -310,6 +346,11 @@ main() {
310346
prompt_and_download
311347
return 1
312348
fi
349+
# Check and install requirements before running the script
350+
if ! check_and_install_requirements "$python"; then
351+
echo "Failed to install requirements. Exiting."
352+
exit 1
353+
fi
313354
# Found it - start our script and pass all args
314355
"$python" "$dir/$target" "${args[@]}"
315356
}

0 commit comments

Comments
 (0)