commit:     e575292be341611ebac6bdbaba694f62fb6f7797
Author:     Henning Schild <henning <AT> hennsch <DOT> de>
AuthorDate: Fri Mar 31 12:39:12 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sat Apr 15 12:43:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e575292b

net-misc/icaclient: enable usb redirect support

We need to copy the content of the usb/ subfolder into ICAROOT and
enable the USB support in module.ini. There are udev rules and a daemon
but none of that seems needed.
Users need to be in 'usb' group, mention that in postinst.

Since we have an increasing number of changes to module.ini and the user
might in fact also want to change stuff (like i.e. FIDO2), we move the
file to /etc. Same goes for usb.conf in which users can customize which
USB devices can be redirected.

Closes: https://bugs.gentoo.org/890539
Signed-off-by: Henning Schild <henning <AT> hennsch.de>
Closes: https://github.com/gentoo/gentoo/pull/30352
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 net-misc/icaclient/icaclient-23.3.0.32.ebuild | 33 +++++++++++++++++++++++----
 net-misc/icaclient/metadata.xml               |  1 +
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/net-misc/icaclient/icaclient-23.3.0.32.ebuild 
b/net-misc/icaclient/icaclient-23.3.0.32.ebuild
index 189b58a4df53..2f09e585711e 100644
--- a/net-misc/icaclient/icaclient-23.3.0.32.ebuild
+++ b/net-misc/icaclient/icaclient-23.3.0.32.ebuild
@@ -13,7 +13,7 @@ SRC_URI="amd64? ( linuxx64-${PV}.tar.gz )
 LICENSE="icaclient"
 SLOT="0"
 KEYWORDS="-* ~amd64 ~x86"
-IUSE="l10n_de l10n_es l10n_fr l10n_ja l10n_zh-CN hdx"
+IUSE="l10n_de l10n_es l10n_fr l10n_ja l10n_zh-CN hdx usb"
 RESTRICT="mirror strip fetch"
 
 ICAROOT="/opt/Citrix/ICAClient"
@@ -96,6 +96,7 @@ RDEPEND="
        x11-libs/pango
        ${BDEPEND}
        !hdx? ( !media-plugins/hdx-realtime-media-engine )
+       usb? ( sys-apps/systemd-utils )
 "
 DEPENDS=""
 
@@ -129,6 +130,14 @@ src_prepare() {
        rm lib/UIDialogLibWebKit.so || die
 
        cp nls/en/module.ini . || die
+       if use usb; then
+               # inspired by debian usb support package postinst
+               sed -i -e 's/^[ \t]*VirtualDriver[ \t]*=.*$/&, GenericUSB/' 
module.ini || die
+               sed -i -e '/\[ICA 3.0\]/a\GenericUSB=on' module.ini || true
+               echo "[GenericUSB]" >> module.ini || true
+               echo "DriverName=VDGUSB.DLL" >> module.ini
+       fi
+
        if use hdx; then
                "${BROOT}${ICAROOT}"/rtme/RTMEconfig -install -ignoremm || die
                mv new_module.ini module.ini || die
@@ -141,8 +150,19 @@ src_install() {
 
        dodir "${ICAROOT}"
 
+       keepdir /etc/icaclient
+
+       insinto "${ICAROOT}"
        exeinto "${ICAROOT}"
        doexe *.DLL libproxy.so wfica AuthManagerDaemon PrimaryAuthManager 
selfservice ServiceRecord
+       if use usb; then
+               doexe usb/ctxusb usb/ctxusbd usb/ctx_usb_isactive
+               doins usb/*.DLL
+               insinto /etc/icaclient
+               doins usb/usb.conf
+               dosym ../../../etc/icaclient/usb.conf "${ICAROOT}"/usb.conf
+               insinto "${ICAROOT}"
+       fi
 
        exeinto "${ICAROOT}"/lib
        doexe lib/*.so
@@ -152,11 +172,10 @@ src_install() {
                doins nls/en.UTF-8/eula.txt
        done
 
-       insinto "${ICAROOT}"
-       doins -r usb
-
        insinto "${ICAROOT}"/config
        doins config/*
+       mv "${ED}/${ICAROOT}"/config/module.ini "${ED}"/etc/icaclient/ || die
+       dosym ../../../../etc/icaclient/module.ini 
"${ICAROOT}"/config/module.ini
        for tmpl in {appsrv,wfclient}.template ; do
                newins nls/en/${tmpl} ${tmpl/template/ini}
        done
@@ -275,6 +294,12 @@ pkg_postinst() {
                        ewarn "not need to be explicitly installed anymore."
                fi
        fi
+
+       if use usb; then
+               einfo
+               einfo "Add users of ${CATEGORY}/${PN} to group 'usb' for 
redirect to work"
+               einfo
+       fi
 }
 
 pkg_postrm() {

diff --git a/net-misc/icaclient/metadata.xml b/net-misc/icaclient/metadata.xml
index 83d0f6942931..3c9ca3ab8356 100644
--- a/net-misc/icaclient/metadata.xml
+++ b/net-misc/icaclient/metadata.xml
@@ -11,5 +11,6 @@
        </maintainer>
        <use>
                <flag name="hdx">Install and enable hdx-realtime-media-engine 
plugin</flag>
+               <flag name="usb">Allow connecting USB devices to virtual 
desktops</flag>
        </use>
 </pkgmetadata>

Reply via email to