-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild-deb.sh
More file actions
143 lines (119 loc) · 5.14 KB
/
build-deb.sh
File metadata and controls
143 lines (119 loc) · 5.14 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
set -e
# Build script for FadCrypt Linux .deb package
echo "=== Building FadCrypt for Linux ==="
# Extract version from core/version.py
VERSION=$(python3 -c "import sys; sys.path.insert(0, '.'); from core.version import __version__; print(__version__)")
PACKAGE_NAME=$(python3 -c "import sys; sys.path.insert(0, '.'); from core.version import PACKAGE_NAME; print(PACKAGE_NAME)")
MAINTAINER=$(python3 -c "import sys; sys.path.insert(0, '.'); from core.version import MAINTAINER_FULL; print(MAINTAINER_FULL)")
DESCRIPTION=$(python3 -c "import sys; sys.path.insert(0, '.'); from core.version import PACKAGE_DESCRIPTION; print(PACKAGE_DESCRIPTION)")
# Strip 'v' prefix from version for Debian package (Debian versions must start with a digit)
DEB_VERSION="${VERSION#v}"
echo "Building version: $VERSION (Debian: $DEB_VERSION)"
# Check dependencies
echo "Checking dependencies..."
command -v python3 >/dev/null 2>&1 || { echo "Error: python3 not found"; exit 1; }
command -v pyinstaller >/dev/null 2>&1 || { echo "Error: pyinstaller not found. Install with: pip install pyinstaller"; exit 1; }
# Clean previous builds
echo "Cleaning previous builds..."
rm -rf build dist fadcrypt-deb
# Build GUI executable with PyInstaller (console=False)
echo "Building GUI executable with PyInstaller..."
python3 -m PyInstaller FadCrypt_Linux.spec --clean --noconfirm
# Check if GUI build succeeded
if [ ! -f "dist/fadcrypt" ]; then
echo "Error: GUI build failed - executable not found at dist/fadcrypt"
exit 1
fi
echo " GUI executable size: $(du -h dist/fadcrypt | cut -f1)"
# Build CLI executable with PyInstaller (console=True)
echo "Building CLI executable with PyInstaller..."
python3 -m PyInstaller FadCrypt_Linux_CLI.spec --clean --noconfirm
# Check if CLI build succeeded
if [ ! -f "dist/fadcrypt-cli" ]; then
echo "Error: CLI build failed - executable not found at dist/fadcrypt-cli"
exit 1
fi
echo " CLI executable size: $(du -h dist/fadcrypt-cli | cut -f1)"
# Create .deb package structure
echo "Creating .deb package structure..."
mkdir -p fadcrypt-deb/DEBIAN
mkdir -p fadcrypt-deb/usr/bin
mkdir -p fadcrypt-deb/usr/share/applications
mkdir -p fadcrypt-deb/usr/share/pixmaps
mkdir -p fadcrypt-deb/usr/share/doc/fadcrypt
mkdir -p fadcrypt-deb/etc/systemd/system
mkdir -p fadcrypt-deb/usr/share/fadcrypt
# Copy files
echo "Copying files..."
# Copy onefile executables directly
cp dist/fadcrypt fadcrypt-deb/usr/bin/
cp dist/fadcrypt-cli fadcrypt-deb/usr/bin/
chmod 755 fadcrypt-deb/usr/bin/fadcrypt
chmod 755 fadcrypt-deb/usr/bin/fadcrypt-cli
cp debian/fadcrypt.desktop fadcrypt-deb/usr/share/applications/
cp debian/fadcrypt-cli.desktop fadcrypt-deb/usr/share/applications/
cp img/1.png fadcrypt-deb/usr/share/pixmaps/fadcrypt.png
cp img/fadcrypt_cli.png fadcrypt-deb/usr/share/pixmaps/fadcrypt_cli.png
cp LICENSE fadcrypt-deb/usr/share/doc/fadcrypt/
cp README.md fadcrypt-deb/usr/share/doc/fadcrypt/
# Copy elevated daemon service and scripts
echo "Installing elevated daemon service..."
cp etc/systemd/system/fadcrypt-elevated.service fadcrypt-deb/etc/systemd/system/
chmod 644 fadcrypt-deb/etc/systemd/system/fadcrypt-elevated.service
# Copy elevated daemon implementation to /usr/share/fadcrypt/
cp core/linux/elevated_daemon.py fadcrypt-deb/usr/share/fadcrypt/elevated-daemon.py
chmod 755 fadcrypt-deb/usr/share/fadcrypt/elevated-daemon.py
# Copy prerm script for cleanup on uninstall
if [ -f debian/prerm ]; then
cp debian/prerm fadcrypt-deb/DEBIAN/
chmod 755 fadcrypt-deb/DEBIAN/prerm
echo "Added prerm script for automatic cleanup on uninstall"
fi
# Copy postinst script for daemon setup
if [ -f debian/postinst ]; then
cp debian/postinst fadcrypt-deb/DEBIAN/
chmod 755 fadcrypt-deb/DEBIAN/postinst
echo "Added postinst script for daemon service setup"
fi
# Set desktop file permissions
chmod 644 fadcrypt-deb/usr/share/applications/fadcrypt.desktop
chmod 644 fadcrypt-deb/usr/share/applications/fadcrypt-cli.desktop
# Create control file with dynamic size
INSTALLED_SIZE=$(du -sk fadcrypt-deb/usr | cut -f1)
cat > fadcrypt-deb/DEBIAN/control << EOF
Package: ${PACKAGE_NAME}
Version: ${DEB_VERSION}
Section: utils
Priority: optional
Architecture: amd64
Installed-Size: ${INSTALLED_SIZE}
Depends: python3 (>= 3.8), libgtk-3-0
Maintainer: ${MAINTAINER}
Description: ${DESCRIPTION}
FadCrypt is a cross-platform GUI application that helps you lock and
monitor applications with password protection and encrypted configuration.
.
Features include:
- Lock/unlock specific applications
- Password-protected monitoring
- System tray integration
- Auto-start on login support
- Built-in mini snake game
EOF
# Build the .deb package with maximum compression
echo "Building .deb package with xz compression..."
dpkg-deb --build --root-owner-group -Zxz -z9 fadcrypt-deb ${PACKAGE_NAME}_${DEB_VERSION}_amd64.deb
# Show size comparison
echo ""
echo "=== Build Complete ==="
echo "Package: ${PACKAGE_NAME}_${DEB_VERSION}_amd64.deb"
echo "Package Size: $(du -h ${PACKAGE_NAME}_${DEB_VERSION}_amd64.deb | cut -f1)"
echo "App Version: ${VERSION}"
echo ""
echo "To install:"
echo " sudo dpkg -i ${PACKAGE_NAME}_${DEB_VERSION}_amd64.deb"
echo ""
echo "To run:"
echo " ${PACKAGE_NAME}"
echo ""