- Enhanced Package Information: Expanded PackageInfo struct with 23 fields including section, priority, maintainer, homepage, size, dependencies, and more - Real Package Data Extraction: Integrated dpkg and apt-cache for actual package information instead of mock data - Professional Debian Packaging: Added man pages, shell completions, postinst/prerm scripts, triggers, and lintian overrides - Enhanced Build System: Improved debian/rules with cross-compilation support, enhanced build.sh with options and validation - CI Workflow Updates: Added missing build dependencies, enhanced package validation, lintian quality checks, and comprehensive reporting - Quality Assurance: Added lintian validation, enhanced file checking, and professional packaging standards - Documentation: Comprehensive README.Debian with build instructions and troubleshooting guide Resolves mock package issues and provides production-ready Debian packaging infrastructure.
89 lines
2.9 KiB
Bash
Executable file
89 lines
2.9 KiB
Bash
Executable file
#!/bin/sh
|
|
# prerm script for apt-ostree
|
|
#
|
|
# This script is executed before the package is removed.
|
|
# It handles pre-removal tasks such as stopping services,
|
|
# backing up configuration files, and checking dependencies.
|
|
|
|
set -e
|
|
|
|
# Package name
|
|
PACKAGE="apt-ostree"
|
|
|
|
# Configuration directories
|
|
CONFIG_DIR="/etc/apt-ostree"
|
|
DATA_DIR="/var/lib/apt-ostree"
|
|
LOG_DIR="/var/log/apt-ostree"
|
|
|
|
case "$1" in
|
|
remove|purge)
|
|
echo "Removing $PACKAGE..."
|
|
|
|
# Check if there are any active OSTree deployments
|
|
if command -v ostree >/dev/null 2>&1; then
|
|
if [ -d "/ostree" ]; then
|
|
echo "Checking for active OSTree deployments..."
|
|
|
|
# Check if there are any deployments
|
|
if ostree admin status 2>/dev/null | grep -q "deployments"; then
|
|
echo "Warning: Active OSTree deployments detected"
|
|
echo "Removing apt-ostree may affect system stability"
|
|
echo "Consider switching to a different deployment before removal"
|
|
|
|
# Ask for confirmation if interactive
|
|
if [ -t 0 ]; then
|
|
echo -n "Do you want to continue with removal? [y/N]: "
|
|
read -r response
|
|
case "$response" in
|
|
[yY]|[yY][eE][sS])
|
|
echo "Continuing with removal..."
|
|
;;
|
|
*)
|
|
echo "Removal cancelled by user"
|
|
exit 1
|
|
;;
|
|
esac
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Stop any running apt-ostree processes
|
|
if pgrep -f "apt-ostree" >/dev/null 2>&1; then
|
|
echo "Stopping running apt-ostree processes..."
|
|
pkill -f "apt-ostree" || true
|
|
sleep 2
|
|
# Force kill if still running
|
|
pkill -9 -f "apt-ostree" || true
|
|
fi
|
|
|
|
# Backup configuration files if removing (not purging)
|
|
if [ "$1" = "remove" ]; then
|
|
echo "Backing up configuration files..."
|
|
if [ -d "$CONFIG_DIR" ]; then
|
|
mkdir -p "/tmp/apt-ostree-backup-$(date +%Y%m%d-%H%M%S)"
|
|
cp -r "$CONFIG_DIR" "/tmp/apt-ostree-backup-$(date +%Y%m%d-%H%M%S)/" || true
|
|
echo "Configuration backed up to /tmp/apt-ostree-backup-*"
|
|
fi
|
|
fi
|
|
|
|
echo "$PACKAGE pre-removal completed"
|
|
;;
|
|
|
|
upgrade)
|
|
echo "Upgrading $PACKAGE..."
|
|
# Nothing special needed for upgrades
|
|
;;
|
|
|
|
failed-upgrade|abort-install|abort-upgrade|abort-remove|abort-deconfigure)
|
|
echo "Aborting $PACKAGE operation..."
|
|
;;
|
|
|
|
*)
|
|
echo "prerm called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Exit successfully
|
|
exit 0
|