#!/bin/bash set -e # Build script for deb-bootupd Debian package # This script builds a proper .deb package following Debian packaging standards echo "๐Ÿณ Building deb-bootupd Debian package..." # Check if we're in the right directory if [ ! -f "Cargo.toml" ] || [ ! -d "debian" ]; then echo "โŒ Error: This script must be run from the deb-bootupd root directory" exit 1 fi # Check for required tools command -v dpkg-buildpackage >/dev/null 2>&1 || { echo "โŒ Error: dpkg-buildpackage not found. Install build-essential and devscripts."; exit 1; } command -v lintian >/dev/null 2>&1 || { echo "โš ๏ธ Warning: lintian not found. Install lintian for package validation."; } # Clean previous builds echo "๐Ÿงน Cleaning previous build artifacts..." rm -rf target/ debian/deb-bootupd/ *.deb *.changes *.buildinfo *.dsc # Build the package echo "๐Ÿ”จ Building Debian package..." dpkg-buildpackage -b -uc -us # Check if build was successful if [ $? -eq 0 ]; then echo "โœ… Package built successfully!" # List generated files echo "๐Ÿ“ฆ Generated files:" ls -la ../*.deb ../*.changes ../*.buildinfo ../*.dsc 2>/dev/null || echo "No package files found in parent directory" # Validate package with lintian if available if command -v lintian >/dev/null 2>&1; then echo "๐Ÿ” Running lintian validation..." lintian ../*.changes || echo "โš ๏ธ Lintian found some issues (see above)" fi echo "" echo "๐ŸŽ‰ deb-bootupd Debian package built successfully!" echo "๐Ÿ“ฆ Install with: sudo dpkg -i ../deb-bootupd_*.deb" echo "๐Ÿ”ง Fix dependencies with: sudo apt-get install -f" else echo "โŒ Package build failed!" exit 1 fi