create the plugdev group in postinst, not config

This commit is contained in:
Daniel Pavel 2013-06-17 16:11:17 +02:00
parent 41409c9b94
commit 82e718b3d1
3 changed files with 32 additions and 32 deletions

View File

@ -18,21 +18,25 @@ plugdev_group_exists() {
}
# if not reconfiguring, and the right daemons are running,
# no reason to do anything
# During normal installation/upgrade, try to avoid bothering the user
# if the current settings are sane.
if test -z "$DEBCONF_RECONFIGURE"; then
consolekit_running && exit 0
systemd_running && exit 0
if db_get solaar/use_plugdev_group; then
test "$RET" = true && plugdev_group_exists && exit 0
else
# If the group already exists, just use it.
plugdev_group_exists && db_set solaar/use_plugdev_group true && exit 0
fi
fi
# if the package hasn't been configured yet, and no seat daemon is running,
# change the default
# If the package hasn't been configured yet, and no seat daemon is running,
# change the default.
if ! db_get solaar/use_plugdev_group; then
if ! consolekit_running && ! systemd_running; then
plugdev_group_exists && db_set solaar/use_plugdev_group true
# if not reconfiguring, we have the right group and the right setting
# no need to ask anything
test -z "$DEBCONF_RECONFIGURE" && exit 0
fi
fi
@ -45,18 +49,7 @@ else
db_subst solaar/use_plugdev_group SEAT_DAEMON_STATUS "NEITHER"
fi
# ask the question
db_input high solaar/use_plugdev_group
db_go
db_get solaar/use_plugdev_group
if test "$RET" = true; then
# make sure the group exists
if ! plugdev_group_exists; then
groupadd --system plugdev || addgroup --system plugdev
fi
# reminder about plugdev membership
db_input high solaar/plugdev_membership
db_go
fi
db_input high solaar/use_plugdev_group || true
db_go || true
exit 0

View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_get solaar/use_plugdev_group
if test "$RET" = true; then
# make sure the group exists if required
if ! getent group plugdev >/dev/null; then
groupadd --system plugdev || addgroup --system plugdev
fi
fi
#DEBHELPER#

View File

@ -1,7 +1,7 @@
Template: solaar/use_plugdev_group
Type: boolean
Default: false
Description: Use plugdev group?
_Description: Use plugdev group?
By default, the Logitech receiver devices are only accessible by the root user.
.
To allow access to regular users (through solaar), the needed ACLs can be
@ -10,18 +10,12 @@ Description: Use plugdev group?
Right now, ${SEAT_DAEMON_STATUS} daemon is running.
.
If neither of these daemons is installed on your system, or you want to make
the receiver accessible to ssh users, members of the 'plugdev' system group
can be given access to the receiver devices.
Template: solaar/plugdev_membership
Type: note
Description:
Don't forget to make sure all your desktop users are members of the plugdev
system group.
.
You can add new members to the group by running, as root:
the receiver accessible to ssh logged-in through ssh, members of the 'plugdev'
system group can be given access to the receiver devices.
.
If you do use the 'plugdev' group, don't forget to make sure all your desktop
users are members of the plugdev system group. You can add new members to the
group by running, as root:
gpasswd --add <username> plugdev
.
For the group membership to take effect, the affected users have to log-out
and log-in again.