#!/bin/sh set -e # Source debconf library . /usr/share/debconf/confmodule # Define package name PACKAGE="apt-ostree" # Function to log messages log() { echo "$PACKAGE: $1" >&2 } # Function to cleanup shell completions cleanup_completions() { log "Cleaning up shell completions..." # Remove bash completion if [ -f /usr/share/bash-completion/completions/apt-ostree ]; then rm -f /usr/share/bash-completion/completions/apt-ostree fi # Remove zsh completion if [ -f /usr/share/zsh/vendor-completions/_apt-ostree ]; then rm -f /usr/share/zsh/vendor-completions/_apt-ostree fi # Reload bash completion if available (skip if problematic) # if [ -f /etc/bash_completion ]; then # . /etc/bash_completion # fi } # Function to cleanup man pages cleanup_man_pages() { log "Cleaning up man pages..." # Remove man page if [ -f /usr/share/man/man1/apt-ostree.1 ]; then rm -f /usr/share/man/man1/apt-ostree.1 fi # Update man page database if command -v mandb >/dev/null 2>&1; then mandb -q || true fi } # Main execution case "$1" in remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) cleanup_completions cleanup_man_pages ;; purge) cleanup_completions cleanup_man_pages ;; *) log "Unknown action: $1" exit 1 ;; esac exit 0