1+ #! /bin/bash
2+ # Script to create the AICommit installer for Linux
3+ # Exit on error
4+ set -e
5+
6+ echo " --- Starting Linux build process ---"
7+
8+ # 1. Create & activate virtual environment
9+ echo " --- Setting up Python virtual environment ---"
10+ python3 -m venv venv
11+ source venv/bin/activate
12+
13+ # 2. Install dependencies
14+ echo " --- Installing dependencies from requirements.txt ---"
15+ pip install -r requirements.txt
16+
17+ # 3. Run PyInstaller
18+ echo " --- Building executable with PyInstaller ---"
19+ pyinstaller --name " AICommit" --windowed --onefile --icon=" assets/icon.ico" main.py
20+
21+ # 4. Prepare installer package
22+ echo " --- Creating Linux installer package ---"
23+ INSTALLER_DIR=" AICommit-linux-installer"
24+ rm -rf $INSTALLER_DIR
25+ mkdir -p $INSTALLER_DIR /usr/local/bin
26+ mkdir -p $INSTALLER_DIR /usr/share/applications
27+ mkdir -p $INSTALLER_DIR /usr/share/icons/hicolor/256x256/apps
28+
29+ # Copy necessary files
30+ cp dist/AICommit $INSTALLER_DIR /usr/local/bin/AICommit
31+ cp assets/icon.png $INSTALLER_DIR /usr/share/icons/hicolor/256x256/apps/AICommit.png
32+ cp scripts/AICommit.desktop $INSTALLER_DIR /usr/share/applications/
33+
34+ # Create the installation script
35+ cat > $INSTALLER_DIR /install.sh << EOL
36+ #!/bin/bash
37+ echo "Installing AICommit..."
38+ sudo cp -r usr /
39+ echo "Updating icon cache..."
40+ sudo gtk-update-icon-cache /usr/share/icons/hicolor || echo "Failed to update icon cache."
41+ echo "Installation complete. Run 'AICommit' from your terminal or find it in your applications menu."
42+ EOL
43+ chmod +x $INSTALLER_DIR /install.sh
44+
45+ # Create the tar.gz archive
46+ TARBALL_NAME=" AICommit-Linux-Installer.tar.gz"
47+ echo " --- Packaging installer into $TARBALL_NAME ---"
48+ tar -czvf $TARBALL_NAME -C $INSTALLER_DIR .
49+
50+ echo " --- Build complete! ---"
51+ echo " Installer created: $TARBALL_NAME "
52+ echo " To install, extract the archive and run './install.sh'"
0 commit comments