From 88e66fdabc8c6b5ff049d99514a74fadec2b0e51 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 28 Oct 2023 23:00:01 -0500 Subject: Qt UI: Add helper to manipulate Xauthority files This allows us to run software after the hostname changes in the Installation Environment and live desktops. Closes: #372 --- ui/qt5/CMakeLists.txt | 4 ++-- ui/qt5/horizon-xauth-helper | 2 ++ ui/qt5/horizon-xauth-helper.1 | 33 +++++++++++++++++++++++++++++++++ ui/qt5/horizonwizard.cc | 7 ++++++- 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 ui/qt5/horizon-xauth-helper create mode 100644 ui/qt5/horizon-xauth-helper.1 (limited to 'ui/qt5') diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt index e94e5b9..449e9bc 100644 --- a/ui/qt5/CMakeLists.txt +++ b/ui/qt5/CMakeLists.txt @@ -93,6 +93,6 @@ IF(INSTALL) ENDIF() install(TARGETS horizon-run-qt5 DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-run-qt5.8 DESTINATION share/man/man8) - install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect DESTINATION bin) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect.1 DESTINATION share/man/man1) + install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect ${CMAKE_CURRENT_SOURCE_DIR}/horizon-xauth-helper DESTINATION bin) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect.1 ${CMAKE_CURRENT_SOURCE_DIR}/horizon-xauth-helper.1 DESTINATION share/man/man1) ENDIF(INSTALL) diff --git a/ui/qt5/horizon-xauth-helper b/ui/qt5/horizon-xauth-helper new file mode 100644 index 0000000..c27050f --- /dev/null +++ b/ui/qt5/horizon-xauth-helper @@ -0,0 +1,2 @@ +#!/bin/sh +xauth -f $HOME/.Xauthority add "$1/unix:0" . $(xauth list ":0" | awk '{print $NF}') diff --git a/ui/qt5/horizon-xauth-helper.1 b/ui/qt5/horizon-xauth-helper.1 new file mode 100644 index 0000000..17a5f2f --- /dev/null +++ b/ui/qt5/horizon-xauth-helper.1 @@ -0,0 +1,33 @@ +.Dd October 28, 2023 +.Dt HORIZON-XAUTH-HELPER 1 +.Os "Adélie Linux" +.Sh NAME +.Nm horizon-xauth-helper +.Nd add new hostname to Xauthority file +.Sh SYNOPSIS +.Nm +.Ar hostname +.Sh DESCRIPTION +The +.Nm +utility ensures that X11 allows new clients to connect from the hostname +of the target system. This ensures that X11 software can be started +after the +.Cm hostname +key is run in the Installation Environment. +.Sh FILES +.Bl -tag -width Ds +.It Pa $HOME/.Xauthority +The +.Nm +utility adds the new hostname to the current user's Xauthority file. +.Sh HISTORY +The +.Nm +command first appeared in Horizon 0.9.8. +.Sh SEE ALSO +.Xr Xsecurity 7 , +.Xr xauth 1 . +.Sh AUTHORS +.An A. Wilcox +.Aq awilfox@adelielinux.org diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index 0dfd43e..5096db9 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -546,7 +546,12 @@ QString HorizonWizard::toHScript() { lines << "network false"; } - lines << ("hostname " + field("hostname").toString()); + const auto hostname = field("hostname").toString(); + lines << ("hostname " + hostname); +#ifdef HAS_INSTALL_ENV + QProcess p; + p.execute("horizon-xauth-helper", {hostname}); +#endif switch(arch) { case aarch64: -- cgit v1.2.3-60-g2f50