[X2Go-Commits] [x2godesktopsharing] 03/13: debian/<config>: Add debconf configuration dialogs that facilitate setting the system-wide default desktop sharing user.
git-admin at x2go.org
git-admin at x2go.org
Mon Nov 12 14:32:32 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2godesktopsharing.
commit 9320515d7b777b55e3240cd6e1f32755f4a4ab0d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Sun Nov 11 18:29:36 2018 +0100
debian/<config>: Add debconf configuration dialogs that facilitate setting the system-wide default desktop sharing user.
---
debian/changelog | 3 +
debian/po/POTFILES.in | 1 +
debian/po/templates.pot | 124 ++++++++++++++++++++++++++++++++++++
debian/settings | 2 +
debian/x2godesktopsharing.config | 65 +++++++++++++++++++
debian/x2godesktopsharing.dirs | 1 +
debian/x2godesktopsharing.install | 3 +-
debian/x2godesktopsharing.postinst | 67 ++++++++++++++-----
debian/x2godesktopsharing.postrm | 40 ++++++++++++
debian/x2godesktopsharing.templates | 61 ++++++++++++++++++
10 files changed, 351 insertions(+), 16 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 8433556..0aeaf79 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,9 @@ x2godesktopsharing (3.1.1.5-0x2go1) UNRELEASED; urgency=medium
.pro file, but debian/rules is easier...).
* debian/x2godesktopsharing.menu:
+ Drop file. The menu file is not allowed if a .desktop file is present.
+ * debian/<config>:
+ + Add debconf configuration dialogs that facilitate setting the system-wide
+ default desktop sharing user.
-- X2Go Release Manager <git-admin at x2go.org> Wed, 15 Nov 2017 22:00:53 +0100
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..94e567d
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] x2godesktopsharing.templates
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 0000000..0462062
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,124 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the x2godesktopsharing package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: x2godesktopsharing\n"
+"Report-Msgid-Bugs-To: x2godesktopsharing at packages.debian.org\n"
+"POT-Creation-Date: 2018-11-11 21:03+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:3001
+msgid "Create group for X2Go Desktop Sharing now?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:3001
+msgid ""
+"X2Go Desktop Sharing requires that users with the privilege to share X2Go/"
+"X11 desktop sessions with other users are placed into a specific group "
+"(default: system group \"x2godesktopsharing\")."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:3001
+msgid ""
+"In X2Go Desktop Sharing's user configuration you can adjust that group later "
+"on. Here, you are asked for the system-wide default."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:3001
+msgid ""
+"If this group is not created now, you should assign this desktop sharing "
+"privilege to an already existing group on the next screen."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:3001
+msgid ""
+"If this group is not created / not assigned, you will not be able to share "
+"X2Go/X11 desktop sessions among different users."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:4001
+msgid "Use already existing groups for X2Go Desktop Sharing?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:4001
+msgid ""
+"If a group appropriate for being assigned the desktop sharing privilege has "
+"already been created (e.g. in an LDAP user/group database) then you can "
+"specify this group name on the next screen."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../x2godesktopsharing.templates:5001
+msgid "Group with X2Go Desktop Sharing privilege:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../x2godesktopsharing.templates:5001
+msgid "Please specify the group name for X2Go Desktop Sharing privilege."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../x2godesktopsharing.templates:5001
+msgid "If you leave this empty, the \"root\" group will be used."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:6001
+msgid "Delete the group that was formerly used for this?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:6001
+msgid "The group for the X2Go Desktop Sharing privilege has been modified."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../x2godesktopsharing.templates:6001
+msgid ""
+"Please specify whether the old group should be deleted. If unsure, keep the "
+"formerly used group and manually investigate later."
+msgstr ""
+
+#. Type: error
+#. Description
+#: ../x2godesktopsharing.templates:7001
+msgid "Non-existing group"
+msgstr ""
+
+#. Type: error
+#. Description
+#: ../x2godesktopsharing.templates:7001
+msgid ""
+"The given group does not exist on this system. You should specify an already "
+"existing group."
+msgstr ""
diff --git a/debian/settings b/debian/settings
new file mode 100644
index 0000000..fc4f7d0
--- /dev/null
+++ b/debian/settings
@@ -0,0 +1,2 @@
+[General]
+group=x2godesktopsharing
diff --git a/debian/x2godesktopsharing.config b/debian/x2godesktopsharing.config
new file mode 100755
index 0000000..a77cb95
--- /dev/null
+++ b/debian/x2godesktopsharing.config
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+# remember the formerly used (or default) group names, if any
+db_get x2godesktopsharing/group-sharing && db_set x2godesktopsharing/last-group-sharing $RET || true
+
+# set the confirmation questions for group deletions always to false before we begin...
+db_set x2godesktopsharing/del-last-group-sharing false
+
+db_input high x2godesktopsharing/create-group-for-sharing || true
+db_go
+db_get x2godesktopsharing/create-group-for-sharing
+create_group=$RET
+
+# always allow usage of existing group (also when $create_group is set)
+db_set x2godesktopsharing/use-existing-group-for-sharing true
+if [ "$create_group" = "false" ]; then
+
+ db_get x2godesktopsharing/group-sharing
+ if [ -z "$RET" ] || ! getent group $RET 1>/dev/null; then
+ db_set x2godesktopsharing/group-sharing "root"
+ fi
+
+ db_input high x2godesktopsharing/use-existing-group-for-sharing || true
+ db_go
+fi
+
+db_get x2godesktopsharing/use-existing-group-for-sharing
+use_existing_group=$RET
+
+if [ "$create_group" = "true" ] || [ "$use_existing_group" = "true" ]; then
+
+ loop=1
+ while [ $loop -eq 1 ]; do
+ db_input high x2godesktopsharing/group-sharing || true
+ db_go
+
+ db_get x2godesktopsharing/group-sharing
+ group_sharing=$RET
+ if getent group $group_sharing 1>/dev/null; then
+ loop=0
+ else
+ if [ "$create_group" = "true" ]; then
+ loop=0
+ else
+ db_input critical x2godesktopsharing/no-such-group || true
+ db_go
+ continue
+ fi
+ fi
+
+ db_get x2godesktopsharing/last-group-sharing
+ if [ -z "$RET" ] || ! getent group $RET 1>/dev/null; then
+ RET="root"
+ fi
+ if [ "$RET" != "$group_sharing" ] && [ $(getent group $RET | cut -d ":" -f 3) -ge 100 ]; then
+ db_input critical x2godesktopsharing/del-last-group-sharing || true
+ db_go
+ fi
+ done
+fi
diff --git a/debian/x2godesktopsharing.dirs b/debian/x2godesktopsharing.dirs
index 7e4dcd7..64b1d6c 100644
--- a/debian/x2godesktopsharing.dirs
+++ b/debian/x2godesktopsharing.dirs
@@ -1,3 +1,4 @@
+etc/x2godesktopsharing
usr/bin
usr/share/applications
usr/share/x2godesktopsharing
diff --git a/debian/x2godesktopsharing.install b/debian/x2godesktopsharing.install
index 1e51109..27dbb08 100644
--- a/debian/x2godesktopsharing.install
+++ b/debian/x2godesktopsharing.install
@@ -1,3 +1,4 @@
VERSION.x2godesktopsharing usr/share/x2go/versions
bin/* usr/bin/
-share/* usr/share/x2go/
\ No newline at end of file
+share/* usr/share/x2go/
+debian/settings etc/x2godesktopsharing/
\ No newline at end of file
diff --git a/debian/x2godesktopsharing.postinst b/debian/x2godesktopsharing.postinst
index 6fd8a1a..6374ca9 100755
--- a/debian/x2godesktopsharing.postinst
+++ b/debian/x2godesktopsharing.postinst
@@ -19,23 +19,60 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
+# Source debconf library.
+. /usr/share/debconf/confmodule
case "$1" in
- configure)
- X2GOGRP=`getent group | grep x2godesktopsharing || true`
- if [ "x$X2GOGRP"="x" ]
- then
- addgroup --system x2godesktopsharing
- fi
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
+ configure)
+
+ # fetch debconf-variables for x2godesktopsharing
+ db_get x2godesktopsharing/create-group-for-sharing && x2godesktopsharing_create_group_for_sharing=$RET
+ db_get x2godesktopsharing/use-existing-group-for-sharing && x2godesktopsharing_use_existing_group_for_sharing=$RET
+
+ # remove previously used sharing group
+
+ db_get x2godesktopsharing/del-last-group-sharing
+ del_last_group="$RET"
+
+ if [ "$del_last_group" = "true" ]; then
+ db_get x2godesktopsharing/last-group-sharing
+ last_group=$(echo $RET | cut -d" " -f1)
+
+ # try to remove the formerly used sharing group; on failure, ignore it
+ getent group $last_group 1>/dev/null && delgroup "$last_group" || \
+ echo "Removing Posix previous X2Go Desktop Sharing group »$last_group« failed."
+ fi
+
+ # create debconf-configured sharing group
+
+ db_get x2godesktopsharing/group-sharing
+ # for sanity: we take everything as a group name until we find a blank...
+ group=$(echo $RET | cut -d" " -f1)
+
+ if [ "$x2godesktopsharing_create_group_for_sharing" = "true" ] && [ "x$group" != "x" ]; then
+ if echo "$group" | egrep '^[[:digit:]]{1,5}$' 1>/dev/null; then
+ echo "Specified sharing group is a gidNumber, not creating any group." 1>&2
+ elif ! getent group $group >/dev/null; then
+ echo "Creating $group group." 1>&2
+ addgroup --system $group
+ else
+ echo "Group »$group« already exists." 1>&2
+ fi
+ fi
+
+ # finally tweak X2Go Desktop Sharing's configuration file and adapt the group parameter
+ if [ -n "$group" ]; then
+ sed -i /etc/x2godesktopsharing/settings -e "s/group=.*/group=$group/"
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
esac
# dh_installdeb will replace this with shell code automatically
diff --git a/debian/x2godesktopsharing.postrm b/debian/x2godesktopsharing.postrm
new file mode 100755
index 0000000..60c06b6
--- /dev/null
+++ b/debian/x2godesktopsharing.postrm
@@ -0,0 +1,40 @@
+#!/bin/sh
+# postrm script for x2godesktopsharing
+
+set -e
+
+# 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 http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+set -e
+
+case "${1}" in
+ 'purge')
+ getent 'group' 'x2godesktopsharing' >'/dev/null' && delgroup 'x2godesktopsharing'
+ ;;
+
+ 'remove'|'upgrade'|'failed-upgrade'|'abort-install'|'abort-upgrade'|'disappear')
+ ;;
+
+ *)
+ echo "postrm called with unknown argument '${1}'" >&2
+ exit '1'
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit '0'
diff --git a/debian/x2godesktopsharing.templates b/debian/x2godesktopsharing.templates
new file mode 100644
index 0000000..8b453ee
--- /dev/null
+++ b/debian/x2godesktopsharing.templates
@@ -0,0 +1,61 @@
+# These templates have been reviewed by the debian-l10n-english
+# team
+#
+# If modifications/additions/rewording are needed, please ask
+# debian-l10n-english at lists.debian.org for advice.
+#
+# Even minor modifications require translation updates and such
+# changes should be coordinated with translators and reviewers.
+
+Template: x2godesktopsharing/last-group-sharing
+Type: string
+Default:
+Description: for internal use
+
+Template: x2godesktopsharing/create-group-for-sharing
+Type: boolean
+Default: true
+_Description: Create group for X2Go Desktop Sharing now?
+ X2Go Desktop Sharing requires that users with the privilege to share
+ X2Go/X11 desktop sessions with other users are placed into a specific
+ group (default: system group "x2godesktopsharing").
+ .
+ In X2Go Desktop Sharing's user configuration you can adjust that group
+ later on. Here, you are asked for the system-wide default.
+ .
+ If this group is not created now, you should assign this desktop sharing
+ privilege to an already existing group on the next screen.
+ .
+ If this group is not created / not assigned, you will not be able to share
+ X2Go/X11 desktop sessions among different users.
+
+Template: x2godesktopsharing/use-existing-group-for-sharing
+Type: boolean
+Default: false
+_Description: Use already existing groups for X2Go Desktop Sharing?
+ If a group appropriate for being assigned the desktop sharing privilege has
+ already been created (e.g. in an LDAP user/group database) then you can
+ specify this group name on the next screen.
+
+Template: x2godesktopsharing/group-sharing
+Type: string
+Default: x2godesktopsharing
+_Description: Group with X2Go Desktop Sharing privilege:
+ Please specify the group name for X2Go Desktop Sharing privilege.
+ .
+ If you leave this empty, the "root" group will be used.
+
+Template: x2godesktopsharing/del-last-group-sharing
+Type: boolean
+Default: false
+_Description: Delete the group that was formerly used for this?
+ The group for the X2Go Desktop Sharing privilege has been modified.
+ .
+ Please specify whether the old group should be deleted. If unsure,
+ keep the formerly used group and manually investigate later.
+
+Template: x2godesktopsharing/no-such-group
+Type: error
+_Description: Non-existing group
+ The given group does not exist on this system. You should specify an
+ already existing group.
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2godesktopsharing.git
More information about the x2go-commits
mailing list