#!/bin/bash # preinst script for linux-patch-api # Created by package build system set -e # Check if this is an upgrade if [ -d "/etc/linux_patch_api" ]; then echo "Detected existing installation - performing upgrade" fi # Create required directories mkdir -p /etc/linux_patch_api/certs mkdir -p /var/lib/linux_patch_api mkdir -p /var/log/linux_patch_api # Set proper ownership (service runs as root) chown -R root:root /var/lib/linux_patch_api chown -R root:root /var/log/linux_patch_api # Set secure permissions chmod 750 /etc/linux_patch_api chmod 750 /etc/linux_patch_api/certs chmod 755 /var/lib/linux_patch_api chmod 755 /var/log/linux_patch_api echo "Pre-installation checks completed successfully" exit 0