apt-ostree/debian/apt-ostree.postrm
joe 76467ece47 feat: Implement comprehensive Debian packaging improvements and enhanced CI workflow
- 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.
2025-08-15 14:05:37 -07:00

132 lines
4 KiB
Bash
Executable file

#!/bin/sh
# postrm script for apt-ostree
#
# This script is executed after the package is removed.
# It handles post-removal cleanup tasks such as removing
# configuration files, cleaning up temporary files, and
# updating system caches.
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)
echo "Post-removal cleanup for $PACKAGE..."
# Remove configuration files
if [ -d "$CONFIG_DIR" ]; then
echo "Removing configuration directory: $CONFIG_DIR"
rm -rf "$CONFIG_DIR"
fi
# Remove data directory
if [ -d "$DATA_DIR" ]; then
echo "Removing data directory: $DATA_DIR"
rm -rf "$DATA_DIR"
fi
# Remove log directory
if [ -d "$LOG_DIR" ]; then
echo "Removing log directory: $LOG_DIR"
rm -rf "$LOG_DIR"
fi
# Remove log rotation configuration
if [ -f "/etc/logrotate.d/apt-ostree" ]; then
echo "Removing log rotation configuration"
rm -f "/etc/logrotate.d/apt-ostree"
fi
# Remove shell completion files
if [ -f "/usr/share/bash-completion/completions/apt-ostree" ]; then
echo "Removing bash completion file"
rm -f "/usr/share/bash-completion/completions/apt-ostree"
fi
if [ -f "/usr/share/zsh/vendor-completions/_apt-ostree" ]; then
echo "Removing zsh completion file"
rm -f "/usr/share/zsh/vendor-completions/_apt-ostree"
fi
# Update shell completion caches
if command -v update-bash-completion >/dev/null 2>&1; then
update-bash-completion apt-ostree || true
fi
# Update man page database
if command -v mandb >/dev/null 2>&1; then
mandb -q || true
fi
echo "$PACKAGE post-removal cleanup completed"
;;
purge)
echo "Post-purge cleanup for $PACKAGE..."
# Remove all remaining files and directories
if [ -d "$CONFIG_DIR" ]; then
echo "Removing configuration directory: $CONFIG_DIR"
rm -rf "$CONFIG_DIR"
fi
if [ -d "$DATA_DIR" ]; then
echo "Removing data directory: $DATA_DIR"
rm -rf "$DATA_DIR"
fi
if [ -d "$LOG_DIR" ]; then
echo "Removing log directory: $LOG_DIR"
rm -rf "$LOG_DIR"
fi
# Remove any remaining configuration files
if [ -f "/etc/logrotate.d/apt-ostree" ]; then
echo "Removing log rotation configuration"
rm -f "/etc/logrotate.d/apt-ostree"
fi
# Remove shell completion files
if [ -f "/usr/share/bash-completion/completions/apt-ostree" ]; then
echo "Removing bash completion file"
rm -f "/usr/share/bash-completion/completions/apt-ostree"
fi
if [ -f "/usr/share/zsh/vendor-completions/_apt-ostree" ]; then
echo "Removing zsh completion file"
rm -f "/usr/share/zsh/vendor-completions/_apt-ostree"
fi
# Update shell completion caches
if command -v update-bash-completion >/dev/null 2>&1; then
update-bash-completion apt-ostree || true
fi
# Update man page database
if command -v mandb >/dev/null 2>&1; then
mandb -q || true
fi
echo "$PACKAGE post-purge cleanup completed"
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|abort-remove|abort-deconfigure)
echo "Post-operation cleanup for $PACKAGE..."
# Nothing special needed for these operations
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Exit successfully
exit 0