FS#64376 - [capnet-assist] Assistant window does not show up automatically
Attached to Project:
Community Packages
Opened by Ingo Heimbach (IngoHeimbach) - Sunday, 03 November 2019, 22:10 GMT
Last edited by Toolybird (Toolybird) - Sunday, 30 April 2023, 06:24 GMT
Opened by Ingo Heimbach (IngoHeimbach) - Sunday, 03 November 2019, 22:10 GMT
Last edited by Toolybird (Toolybird) - Sunday, 30 April 2023, 06:24 GMT
|
Details
Description:
Additional info: * package version: 2.2.3-1 Steps to reproduce: The package version 2.2.3-1 does not show up an assistant window on public Wifis due to a bug in `/etc/NetworkManager/dispatcher.d/90captive_portal_test`. This patch fixes that behavior: ``` --- /etc/NetworkManager/dispatcher.d/90captive_portal_test 2019-02-01 17:41:19.000000000 +0100 +++ /etc/NetworkManager/dispatcher.d/90captive_portal_test.patched 2019-11-03 22:34:32.067793254 +0100 @@ -22,13 +22,11 @@ #launch the browser, but on boot we need to wait that nm-applet starts start_browser() { local user="$1" - local display="$2" - export DISPLAY="$display" wait_for_process nm-applet - $logger "Running browser as '$user' with display '$display' to login in captive portal" - su "$user" -s /bin/sh -c "io.elementary.capnet-assist 2>/dev/null" + $logger "Running browser as '$user' with display '$DISPLAY' and dbus session bus address '$DBUS_SESSION_BUS_ADDRESS' to login in captive portal" + su -w DISPLAY,DBUS_SESSION_BUS_ADDRESS -c "io.elementary.capnet-assist 2>/dev/null" - "$user" } # Run the right scripts @@ -36,10 +34,10 @@ up|vpn-up) $logger -p user.debug "DetectCaptivePortal script triggered" - # Match 2nd column of who's output with ' :[at least one digit] ' - who | awk '$2 ~ /:[0-9]+/ { print $1 " " $2; };' | \ - while read user display; do - start_browser $user $display || $logger -p user.err "failed for user: '$user' display: '$display')" + who | awk '{ print $1 }' | uniq | \ + while read user; do + eval "$(ps -u $user e -e -o cmd | awk '$0 ~ /^[^[:space:]]*dbus-daemon.*[[:space:]]--session/ { for(i=2; i<=NF; i++) print $i }' | awk '{ sub(/=/," ") }1' | awk '$1 == "DISPLAY" || $1 == "DBUS_SESSION_BUS_ADDRESS" { printf "export %s=\"%s\";", $1, $2 }')" + start_browser $user || $logger -p user.err "failed for user: '$user' display: '$DISPLAY' dbus session bus address: $DBUS_SESSION_BUS_ADDRESS)" done ;; *) ``` You can apply the patch file with `patch -d/ -p1 <patch_file>`. |
This task depends upon
Closed by Toolybird (Toolybird)
Sunday, 30 April 2023, 06:24 GMT
Reason for closing: Fixed
Additional comments about closing: See comments
Sunday, 30 April 2023, 06:24 GMT
Reason for closing: Fixed
Additional comments about closing: See comments
I suggest you replace a 90captive_portal_test script. Here is the one I have tested to work.
[1] https://github.com/elementary/capnet-assist/pull/66