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
This commit is contained in:
goodroot 2025-09-30 11:25:56 -07:00
parent 3e3cd0e079
commit 79ee98db6e

View file

@ -1,6 +1,24 @@
post_install() {
# Run setup with Waybar integration enabled by default
HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup
# 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'