Some checks failed
CI/CD Pipeline / Code Format (push) Failing after 12s
CI/CD Pipeline / Clippy Lints (push) Failing after 5m34s
CI/CD Pipeline / Unit Tests (push) Failing after 10m51s
CI/CD Pipeline / Build Debian Package (push) Failing after 1s
CI/CD Pipeline / Build RPM Package (push) Failing after 1s
CI/CD Pipeline / Build Alpine Package (push) Failing after 2s
CI/CD Pipeline / Build Arch Package (push) Failing after 2s
CI/CD Pipeline / Create Release (push) Has been skipped
CI/CD Pipeline / Security Audit (push) Failing after 15m40s
65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# postrm script for linux-patch-api
|
|
# Created by package build system
|
|
|
|
set -e
|
|
|
|
# Handle purge - remove all configuration and data
|
|
if [ "$1" = "purge" ]; then
|
|
echo "Purging linux-patch-api configuration and data..."
|
|
|
|
# Stop service if still running
|
|
if systemctl is-active --quiet linux-patch-api.service 2>/dev/null; then
|
|
systemctl stop linux-patch-api.service
|
|
fi
|
|
|
|
# Disable service
|
|
if systemctl is-enabled --quiet linux-patch-api.service 2>/dev/null; then
|
|
systemctl disable linux-patch-api.service
|
|
fi
|
|
|
|
# Reload systemd to remove service file
|
|
systemctl daemon-reload
|
|
|
|
# Remove configuration directory (preserved by conffiles during normal remove)
|
|
if [ -d "/etc/linux_patch_api" ]; then
|
|
echo "Removing /etc/linux_patch_api..."
|
|
rm -rf /etc/linux_patch_api
|
|
fi
|
|
|
|
# Remove data directory
|
|
if [ -d "/var/lib/linux_patch_api" ]; then
|
|
echo "Removing /var/lib/linux_patch_api..."
|
|
rm -rf /var/lib/linux_patch_api
|
|
fi
|
|
|
|
# Remove log directory
|
|
if [ -d "/var/log/linux_patch_api" ]; then
|
|
echo "Removing /var/log/linux_patch_api..."
|
|
rm -rf /var/log/linux_patch_api
|
|
fi
|
|
|
|
# Remove system user
|
|
if getent passwd linux-patch-api > /dev/null 2>&1; then
|
|
echo "Removing user linux-patch-api..."
|
|
userdel linux-patch-api 2>/dev/null || true
|
|
fi
|
|
|
|
# Remove system group
|
|
if getent group linux-patch-api > /dev/null 2>&1; then
|
|
echo "Removing group linux-patch-api..."
|
|
groupdel linux-patch-api 2>/dev/null || true
|
|
fi
|
|
|
|
echo "linux-patch-api purged successfully"
|
|
fi
|
|
|
|
# Handle upgrade/remove - just ensure service is disabled
|
|
if [ "$1" = "remove" ] || [ "$1" = "upgrade" ]; then
|
|
# Service should already be stopped by prerm
|
|
# Just reload systemd to remove the service file
|
|
systemctl daemon-reload 2>/dev/null || true
|
|
fi
|
|
|
|
exit 0
|