forked from Hogjects/Lufus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappimage-setup.sh
More file actions
executable file
·101 lines (87 loc) · 3.4 KB
/
Copy pathappimage-setup.sh
File metadata and controls
executable file
·101 lines (87 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
set -euo pipefail
ls -la
if [[ -f "appimage-installer-config.sh" ]]; then
echo "File is detected, we will proceed to install..."
source appimage-installer-config.sh >> appimage-setup.log
fi
if command -v python3 &>/dev/null; then
PYTHON=python3
elif command -v python &>/dev/null; then
PYTHON=python
else
echo "FAILED to make PYTHON variable... both python3 and python don't exist here... :c"
exit 1
fi
$PYTHON -m venv .venv-temp
source .venv-temp/bin/activate
# Install Python dependencies from file
$PYTHON -m pip install -r requirements-python.txt
# ----------------------------------------------------------------
# 4. Download and extract linuxdeploy (no Qt plugin needed)
# ----------------------------------------------------------------
rm -rf linuxdeploy-bin
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appimage-extract > /dev/null
mv squashfs-root linuxdeploy-bin
export PATH="$PWD/linuxdeploy-bin/usr/bin:$PATH"
# ----------------------------------------------------------------
# 5. Clean previous builds
# ----------------------------------------------------------------
rm -rf build dist AppDir
# ----------------------------------------------------------------
# 6. Run PyInstaller
# ----------------------------------------------------------------
$PYTHON -m PyInstaller src/lufus/__main__.py \
--name lufus \
--windowed \
--paths src \
--hidden-import PyQt6.QtCore \
--hidden-import PyQt6.QtGui \
--hidden-import PyQt6.QtWidgets \
--hidden-import PyQt6.QtSvg \
--collect-all psutil \
--hidden-import lufus.drives.autodetect_usb \
--hidden-import lufus.drives.states \
--add-data "src/lufus/gui:lufus/gui" \
--noconfirm
# ----------------------------------------------------------------
# 7. Prepare AppDir structure
# ----------------------------------------------------------------
mkdir -p AppDir/usr/bin
cp -r dist/lufus/* AppDir/usr/bin/
# Create desktop file
cat > AppDir/lufus.desktop <<'DESKTOP'
[Desktop Entry]
Name=Lufus
Exec=lufus
Icon=lufus
Type=Application
Categories=Utility;
DESKTOP
# Create dummy icon (or copy your real one if present)
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
if [ -f src/lufus/gui/assets/lufus.png ]; then
cp src/lufus/gui/assets/lufus.png AppDir/usr/share/icons/hicolor/256x256/apps/lufus.png
else
# Create a minimal PNG (1x1 transparent) using base64
echo "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" | base64 -d > AppDir/usr/share/icons/hicolor/256x256/apps/lufus.png
fi
# ----------------------------------------------------------------
# 8. Run linuxdeploy to bundle libraries and produce AppImage
# ----------------------------------------------------------------
linuxdeploy --appdir AppDir \
--executable AppDir/usr/bin/lufus \
--desktop-file AppDir/lufus.desktop \
--output appimage
# ----------------------------------------------------------------
# 9. Rename the AppImage to a predictable name
# ----------------------------------------------------------------
# mv lufus-*.AppImage Lufus-x86_64.AppImage
rm -f linuxdeploy-x86_64.AppImage
rm -f linuxdeploy-x86_64.AppImage.*
rm -rf AppDir
rm -rf .venv-temp
rm -rf linuxdeploy-bin
echo " Build finished inside container."