From a300c36fea5299547fb96dabf3a6866b7834148e Mon Sep 17 00:00:00 2001
From: Ulrich Sibiller <uli42@gmx.de>
Date: Fri, 12 Mar 2021 11:43:34 +0100
Subject: [PATCH 3/4] add new subpackage x2godialog

Fixes https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1228 1/2
---
 Makefile                                    |  7 +++
 debian/control                              | 24 +++++++++
 debian/x2goserver-x2godialog.install        |  2 +
 debian/x2goserver-x2godialog.postinst       | 25 +++++++++
 debian/x2goserver-x2godialog.postrm         | 25 +++++++++
 debian/x2goserver-x2godialog.preinst        | 22 ++++++++
 x2goserver-x2godialog/Makefile              | 78 +++++++++++++++++++++++++++++
 x2goserver-x2godialog/bin/.keep             |  0
 x2goserver-x2godialog/man/man1/x2godialog.1 | 24 +++++++++
 x2goserver.spec                             | 27 ++++++++++
 10 files changed, 234 insertions(+)
 create mode 100644 debian/x2goserver-x2godialog.install
 create mode 100755 debian/x2goserver-x2godialog.postinst
 create mode 100755 debian/x2goserver-x2godialog.postrm
 create mode 100755 debian/x2goserver-x2godialog.preinst
 create mode 100755 x2goserver-x2godialog/Makefile
 create mode 100644 x2goserver-x2godialog/bin/.keep
 create mode 100644 x2goserver-x2godialog/man/man1/x2godialog.1

diff --git a/Makefile b/Makefile
index 08a6d10..b293496 100755
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,7 @@ build_man2html:
 	$(MAKE) -C x2goserver-xsession $@
 	$(MAKE) -C x2goserver-fmbindings $@
 	$(MAKE) -C x2goserver-desktopsharing $@
+	$(MAKE) -C x2goserver-x2godialog $@
 
 clean:
 	-$(MAKE) -f Makefile.perl clean
@@ -41,6 +42,7 @@ clean:
 	$(MAKE) -C x2goserver-xsession $@
 	$(MAKE) -C x2goserver-fmbindings $@
 	$(MAKE) -C x2goserver-desktopsharing $@
+	$(MAKE) -C x2goserver-x2godialog $@
 
 distclean:
 	-$(MAKE) -f Makefile.perl realclean
@@ -54,6 +56,7 @@ distclean:
 	$(MAKE) -C x2goserver-xsession clean
 	$(MAKE) -C x2goserver-fmbindings clean
 	$(MAKE) -C x2goserver-desktopsharing $@
+	$(MAKE) -C x2goserver-x2godialog $@
 
 build-arch:
 	$(MAKE) -C x2goserver-common $@
@@ -66,6 +69,7 @@ build-arch:
 	$(MAKE) -C x2goserver-xsession $@
 	$(MAKE) -C x2goserver-fmbindings $@
 	$(MAKE) -C x2goserver-desktopsharing $@
+	$(MAKE) -C x2goserver-x2godialog $@
 
 build-indep:
 	$(PERL) Makefile.PL INSTALLDIRS=$(PERL_INSTALLDIRS)
@@ -80,6 +84,7 @@ build-indep:
 	$(MAKE) -C x2goserver-xsession $@
 	$(MAKE) -C x2goserver-fmbindings $@
 	$(MAKE) -C x2goserver-desktopsharing $@
+	$(MAKE) -C x2goserver-x2godialog $@
 
 install:
 	$(MAKE) -f Makefile.perl pure_install
@@ -93,12 +98,14 @@ install:
 	$(MAKE) -C x2goserver-xsession $@
 	$(MAKE) -C x2goserver-fmbindings $@
 	$(MAKE) -C x2goserver-desktopsharing $@
+	$(MAKE) -C x2goserver-x2godialog $@
 
 uninstall:
 	$(MAKE) -C x2goserver-printing $@
 	$(MAKE) -C x2goserver-x2goagent $@
 	$(MAKE) -C x2goserver-x2gokdrive $@
 	$(MAKE) -C x2goserver-xsession $@
+	$(MAKE) -C x2goserver-x2godialog $@
 	$(MAKE) -C x2goserver-desktopsharing $@
 	$(MAKE) -C x2goserver-fmbindings $@
 	$(MAKE) -C x2goserver-extensions $@
diff --git a/debian/control b/debian/control
index 81ad6aa..042acc5 100644
--- a/debian/control
+++ b/debian/control
@@ -65,6 +65,7 @@ Recommends:
  x2goserver-printing (>= ${source:Version}),
  x2goserver-xsession (<< ${source:Version}.1~),
  x2goserver-xsession (>= ${source:Version}),
+ x2goserver-x2godialog,
  xfonts-base,
  xinit,
 Suggests:
@@ -310,6 +311,29 @@ Description: X2Go Server's X2Go Agent Xserver
  Please refer to the nxagent package's description for more information
  on NX.
 
+Package: x2goserver-x2godialog
+Architecture: any
+Pre-Depends:
+ dpkg (>= 1.15.7.2),
+Depends:
+ nxdialog,
+ ${misc:Depends},
+Suggests:
+ x2goserver,
+Breaks:
+Replaces:
+Description: X2Go Server's X2Go dialog tool
+ X2Go is a software suite that uses NX and/or KDrive technology for
+ remote desktop computing.
+ .
+ NX technology implements a very efficient compression of the X11
+ protocol. This increases performance when using X applications over a
+ network, especially a slow one.
+ .
+ This package is a wrapper that activates X2Go branding in nxdialog.
+ Please refer to the nxagent package's description for more information
+ on NX.
+
 Package: x2goserver-x2gokdrive
 Architecture: any
 Pre-Depends:
diff --git a/debian/x2goserver-x2godialog.install b/debian/x2goserver-x2godialog.install
new file mode 100644
index 0000000..09ad1b4
--- /dev/null
+++ b/debian/x2goserver-x2godialog.install
@@ -0,0 +1,2 @@
+usr/bin/x2godialog
+usr/share/man/man1/x2godialog.1*
diff --git a/debian/x2goserver-x2godialog.postinst b/debian/x2goserver-x2godialog.postinst
new file mode 100755
index 0000000..1dd033a
--- /dev/null
+++ b/debian/x2goserver-x2godialog.postinst
@@ -0,0 +1,25 @@
+#!/bin/sh
+# postinst script for x2goserver-x2godialog
+
+set -e
+
+# see: dh_installdeb(1)
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit '0'
diff --git a/debian/x2goserver-x2godialog.postrm b/debian/x2goserver-x2godialog.postrm
new file mode 100755
index 0000000..1f45c88
--- /dev/null
+++ b/debian/x2goserver-x2godialog.postrm
@@ -0,0 +1,25 @@
+#!/bin/sh
+# postrm script for x2goserver-x2godialog
+
+set -e
+
+# see: dh_installdeb(1)
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see /usr/share/doc/packaging-manual/
+
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit '0'
diff --git a/debian/x2goserver-x2godialog.preinst b/debian/x2goserver-x2godialog.preinst
new file mode 100755
index 0000000..2d7f031
--- /dev/null
+++ b/debian/x2goserver-x2godialog.preinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+# preinst script for x2goserver-x2godialog
+
+set -e
+
+# see: dh_installdeb(1)
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+#
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit '0'
diff --git a/x2goserver-x2godialog/Makefile b/x2goserver-x2godialog/Makefile
new file mode 100755
index 0000000..f6a6857
--- /dev/null
+++ b/x2goserver-x2godialog/Makefile
@@ -0,0 +1,78 @@
+#!/usr/bin/make -f
+
+SRC_DIR=$(CURDIR)
+SHELL=/bin/bash
+
+INSTALL_DIR=install -d -o root -g root -m 755
+INSTALL_FILE=install -o root -g root -m 644
+INSTALL_PROGRAM=install -o root -g root -m 755
+INSTALL_SYMLINK=ln -s -f
+
+RM_FILE=rm -f
+RM_DIR=rmdir -p --ignore-fail-on-non-empty
+
+DESTDIR ?=
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/share/man
+
+BIN_SCRIPTS=x2godialog $(shell cd bin && echo *)
+
+man_pages = `cd man && find * -type f`
+
+MAN2HTML_BIN  = $(shell which man2html)
+MAN2HTML_SRC  = man
+MAN2HTML_DEST = .build_man2html/html
+
+all: clean build
+
+build: build-arch build-indep
+
+build-arch:
+
+build-indep: build_man2html
+
+build_man2html:
+	if [ -n "$(MAN2HTML_BIN)" ]; then \
+	    mkdir -p $(MAN2HTML_DEST); \
+	    for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \
+	    for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \
+	fi
+
+clean: clean_man2html
+
+clean_man2html:
+	rm -rf `dirname $(MAN2HTML_DEST)`
+
+install: install_scripts install_config install_data install_man install_version
+
+install_scripts:
+	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
+	$(INSTALL_SYMLINK) nxdialog $(DESTDIR)$(BINDIR)/x2godialog
+
+install_data:
+
+install_config:
+
+install_man:
+	$(INSTALL_DIR) $(DESTDIR)$(MANDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man1
+	$(INSTALL_FILE) man/man1/*.1           $(DESTDIR)$(MANDIR)/man1
+	gzip -f $(DESTDIR)$(MANDIR)/man1/x2go*.1
+
+install_version:
+
+uninstall: uninstall_scripts uninstall_config uninstall_data uninstall_man uninstall_version
+
+uninstall_scripts:
+	for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(BINDIR)/$$file; done
+
+uninstall_data:
+
+uninstall_config:
+
+uninstall_man:
+	for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man1/$$file.1.gz; done
+	$(RM_DIR)  $(DESTDIR)$(MANDIR) || true
+
+uninstall_version:
diff --git a/x2goserver-x2godialog/bin/.keep b/x2goserver-x2godialog/bin/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/x2goserver-x2godialog/man/man1/x2godialog.1 b/x2goserver-x2godialog/man/man1/x2godialog.1
new file mode 100644
index 0000000..99b0712
--- /dev/null
+++ b/x2goserver-x2godialog/man/man1/x2godialog.1
@@ -0,0 +1,24 @@
+.TH x2godialog 1 "Nov 2018" "Version 4.1.0.4"
+.SH NAME
+x2godialog \- X2Go dialog tool.
+.SH SYNOPSIS
+.B x2godialog
+.I "[options]"
+
+.SH DESCRIPTION
+\fBx2godialog\fR is a wrapper around nxdialog which is an a tool
+to display graphical requestor windows which called used by x2goagent.
+
+.SH OPTIONS
+.TP
+.B \--help
+Lists all others options that are not listed here. For the complete
+manpage please refer to the nxdialog manpage.
+
+.SH FURTHER READINGS
+Information on X2Go: https://wiki.x2go.org
+.PP
+Information on NX: https://github.com/ArcticaProject/nx-libs
+
+.SH AUTHOR
+This manual page was written by Ulrich Sibiller <uli42@gmx.de>.
diff --git a/x2goserver.spec b/x2goserver.spec
index 57cc91c..16db62c 100644
--- a/x2goserver.spec
+++ b/x2goserver.spec
@@ -372,6 +372,23 @@ This package is a wrapper that activates X2Go branding in nxagent.
 Please refer to the nxagent package's description for more information
 on NX.
 
+%package x2godialog
+Group:          Applications/System
+Summary:        X2Go Server's X2Go Agent Xserver
+Requires:       nxdialog
+
+%description x2godialog
+X2Go is a software suite that uses NX and/or KDrive technology for remote
+desktop computing.
+
+NX technology implements a very efficient compression of the X11
+protocol. This increases performance when using X applications over a
+network, especially a slow one.
+
+This package is a wrapper that activates X2Go branding in nxdialog.
+Please refer to the nxagent package's description for more information
+on NX.
+
 %package x2gokdrive
 Group:          Applications/System
 Summary:        X2Go Server's X2Go KDrive Xserver
@@ -913,6 +930,7 @@ fi
 %exclude %{_bindir}/x2gofm
 %exclude %{_bindir}/x2goprint
 %exclude %{_bindir}/x2goagent
+%exclude %{_bindir}/x2godialog
 %exclude %{_bindir}/x2go*-desktopsharing
 %dir %{_libdir}/x2go
 %{_libdir}/x2go/x2gochangestatus
@@ -947,6 +965,7 @@ fi
 %exclude %{_mandir}/man8/x2goserver-run-extensions.8*
 %exclude %{_mandir}/man8/x2go*-desktopsharing.8*
 %exclude %{_mandir}/man1/x2goagent.1*
+%exclude %{_mandir}/man1/x2godialog.1*
 %dir %{_datadir}/x2go/
 %dir %{_datadir}/x2go/x2gofeature.d/
 %{_datadir}/x2go/x2gofeature.d/x2goserver.features
@@ -1125,4 +1144,12 @@ fi
 %config(noreplace) %{_sysconfdir}/logcheck/ignore.d.server/x2goserver
 
 
+%files x2godialog
+%defattr(-,root,root)
+%doc debian/copyright
+%doc debian/changelog
+%{_bindir}/x2godialog
+%{_mandir}/man1/x2godialog.1*
+
+
 %changelog
-- 
2.9.3

