Closed allergicapple closed 9 hours ago
Hi, Yes, just had the same issue when recovering my system. We need to overthink and improve it.
Great, was just about to create an example:
$ cat > "/tmp/trigger.sh" << EOF
#!/usr/bin/env sh
echo "TTY is $(tty)"
EOF
$ sh /tmp/trigger.sh
Gives:
TTY is /dev/pts/1
even when run from a plain tty.
Reference: https://github.com/CachyOS/cachyos-hooks/blob/c6cc94d28cbb0fc3a67bff824543d0bca88c5827/cachyos-reboot-required#L21
Calling
$(tty)
only returns/dev/tty*
when the command is issued manually on the tty console.This logic fails however when the
cachyos-reboot-required.hook
gets called when pacman is active inside a script, thentty
returns/dev/pts/*
because of the i/o redirects.So the hook thinks it is inside an desktop environment and sends a notification - which doesn't work as there is none because the update script in run from a tty console. This amounts to a hang when dbus tries to send the notification to a nonexisting notification daemon.