picodulce-deb/DEBIAN/rules
2025-01-21 03:23:34 +00:00

60 lines
1.6 KiB
Makefile

#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
# Nothing to build
override_dh_auto_install:
# Clone the repository
mkdir -p $(CURDIR)/debian/picodulce/usr/share/picodulce
git clone https://github.com/nixietab/picodulce.git $(CURDIR)/debian/picodulce/usr/share/picodulce
# Create a virtual environment
python3 -m venv $(CURDIR)/debian/picodulce/usr/share/picodulce/venv
# Install dependencies
. $(CURDIR)/debian/picodulce/usr/share/picodulce/venv/bin/activate && pip install -r $(CURDIR)/debian/picodulce/usr/share/picodulce/requirements.txt
# Create the run.sh script
install -Dm755 /dev/stdin $(CURDIR)/debian/picodulce/usr/share/picodulce/run.sh <<EOL
#!/bin/bash
if [ ! -d "venv" ]; then
echo "venv folder does not exist. Creating virtual environment..."
python3 -m venv venv
source venv/bin/activate
echo "Installing required packages..."
pip install -r requirements.txt
else
source venv/bin/activate
fi
python picodulce.py
EOL
# Create a desktop entry
install -Dm644 /dev/stdin $(CURDIR)/debian/picodulce/usr/share/applications/picodulce.desktop <<EOL
[Desktop Entry]
Name=Picodulce
Exec=/usr/share/picodulce/run.sh
Icon=/usr/share/picodulce/launcher_icon.ico
Terminal=true
Type=Application
Comment=Picodulce Launcher
Categories=Game;
EOL
# Create a bin entry
install -Dm755 /dev/stdin $(CURDIR)/debian/picodulce/usr/bin/picodulce <<EOL
#!/bin/bash
cd /usr/share/picodulce/
exec ./run.sh
EOL
# Ensure permissions
chown -R root:root $(CURDIR)/debian/picodulce/usr/share/picodulce
chmod -R u+w $(CURDIR)/debian/picodulce/usr/share/picodulce