1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/bin/sh # debian/postinst - LIVEN post-installation script set -e case "$1" in configure) # 1. Secure and preserve data directory if [ -d /var/lib/liven ]; then echo "LIVEN data directory '/var/lib/liven' already exists. Preserving existing .liven data blocks." else echo "Creating LIVEN data directory with secure permissions (700)..." mkdir -p /var/lib/liven chmod 700 /var/lib/liven fi # Create log directory with secure permissions (700) if [ ! -d /var/log/liven ]; then echo "Creating LIVEN log directory with secure permissions (700)..." mkdir -p /var/log/liven chmod 700 /var/log/liven fi # 2. Configure systemd integration if [ -d /run/systemd/system ] || [ -d /lib/systemd/system ]; then echo "Reloading systemd daemon..." systemctl daemon-reload || true echo "Enabling and starting LIVEN background service..." systemctl enable liven || true systemctl restart liven || true fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0