75 lines
2.2 KiB
Bash
75 lines
2.2 KiB
Bash
#!/bin/sh
|
|
# postinst script for linux-hello-daemon
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
case "$1" in
|
|
configure)
|
|
# Create linux-hello system user if it doesn't exist
|
|
if ! getent passwd linux-hello > /dev/null 2>&1; then
|
|
echo "Creating linux-hello system user..."
|
|
adduser --system --group --no-create-home \
|
|
--home /var/lib/linux-hello \
|
|
--gecos "Linux Hello Face Authentication" \
|
|
linux-hello
|
|
fi
|
|
|
|
# Create and set permissions on state directory
|
|
if [ ! -d /var/lib/linux-hello ]; then
|
|
mkdir -p /var/lib/linux-hello
|
|
fi
|
|
# State directory: 0750 (owner: root, group: linux-hello)
|
|
chown root:linux-hello /var/lib/linux-hello
|
|
chmod 0750 /var/lib/linux-hello
|
|
|
|
# Create templates subdirectory
|
|
if [ ! -d /var/lib/linux-hello/templates ]; then
|
|
mkdir -p /var/lib/linux-hello/templates
|
|
fi
|
|
chown root:linux-hello /var/lib/linux-hello/templates
|
|
chmod 0750 /var/lib/linux-hello/templates
|
|
|
|
# Create runtime directory for socket
|
|
if [ ! -d /run/linux-hello ]; then
|
|
mkdir -p /run/linux-hello
|
|
fi
|
|
# Socket directory: needs to be accessible for authentication
|
|
chown root:linux-hello /run/linux-hello
|
|
chmod 0750 /run/linux-hello
|
|
|
|
# Configuration file permissions: 0644 (readable by all)
|
|
if [ -f /etc/linux-hello/config.toml ]; then
|
|
chmod 0644 /etc/linux-hello/config.toml
|
|
fi
|
|
|
|
# Add video group to linux-hello user for camera access
|
|
if getent group video > /dev/null 2>&1; then
|
|
usermod -a -G video linux-hello 2>/dev/null || true
|
|
fi
|
|
|
|
# Add tss group for TPM access if available
|
|
if getent group tss > /dev/null 2>&1; then
|
|
usermod -a -G tss linux-hello 2>/dev/null || true
|
|
fi
|
|
|
|
# Reload systemd daemon
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload || true
|
|
fi
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|