aur/hyprwhspr.install
goodroot 79ee98db6e Fix critical post_install user context issues
- Run setup as actual user instead of root
- Proper user detection with fallback
- Fixes run.sh permissions and systemd service paths
- Ensures proper group membership for /dev/uinput access
2025-09-30 11:25:56 -07:00

69 lines
1.5 KiB
Text

post_install() {
# Detect the actual user (not root)
if [ -n "$SUDO_USER" ]; then
ACTUAL_USER="$SUDO_USER"
else
# Fallback: find first non-root user
ACTUAL_USER=$(stat -c '%U' /home 2>/dev/null | head -1 || echo "")
fi
if [ -n "$ACTUAL_USER" ] && [ "$ACTUAL_USER" != "root" ]; then
# Run setup as the actual user
sudo -u "$ACTUAL_USER" bash -c 'HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup' || {
echo "Warning: Could not run setup as user $ACTUAL_USER. Please run manually:"
echo " hyprwhspr-setup"
echo " HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup"
}
else
echo "Warning: Could not determine user. Please run setup manually:"
echo " hyprwhspr-setup"
echo " HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup"
fi
cat <<'EOF'
hyprwhspr installed and configured!
Services running: ydotoold.service, hyprwhspr.service
Waybar integration configured
Whisper models downloaded
User configuration created
IMPORTANT: Log out and log back in for permissions to take effect
(Required for /dev/uinput access)
Check status:
systemctl --user status hyprwhspr.service
Logs:
journalctl --user -u hyprwhspr.service
EOF
}
post_upgrade() {
cat <<'EOF'
hyprwhspr upgraded.
If needed, re-run setup (idempotent):
hyprwhspr-setup
Service status:
systemctl --user status ydotoold.service
systemctl --user status hyprwhspr.service
EOF
}
post_remove() {
cat <<'EOF'
hyprwhspr removed.
Note: user data remains (remove manually if desired):
~/.config/hyprwhspr
~/.local/share/hyprwhspr
EOF
}