use debconf to check if the plugdev group is necessary
This commit is contained in:
parent
57c759773a
commit
41409c9b94
|
@ -3,7 +3,7 @@ Section: misc
|
|||
Priority: optional
|
||||
Maintainer: Daniel Pavel <daniel.pavel@gmail.com>
|
||||
Build-Depends: debhelper (>= 8)
|
||||
Build-Depends-Indep: python
|
||||
Build-Depends-Indep: python, po-debconf
|
||||
X-Python-Version: >= 2.7
|
||||
X-Python3-Version: >= 3.2
|
||||
Standards-Version: 3.9.4
|
||||
|
@ -13,10 +13,10 @@ Vcs-browser: http://github.com/pwr/Solaar
|
|||
|
||||
Package: solaar
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, udev (>= 175), passwd | adduser,
|
||||
Depends: ${misc:Depends}, ${debconf:Depends}, udev (>= 175), passwd | adduser,
|
||||
${python:Depends}, python-pyudev (>= 0.13), python-gi (>= 3.2), gir1.2-gtk-3.0 (>= 3.4),
|
||||
${DesktopIconTheme}
|
||||
Recommends: gir1.2-notify-0.7
|
||||
Recommends: gir1.2-notify-0.7, consolekit (>= 0.4.3) | systemd (>= 44)
|
||||
Suggests: solaar-gnome3 (= ${source:Version})
|
||||
Description: Logitech Unifying Receiver peripherals manager for Linux
|
||||
Solaar is a Linux device manager for Logitech's Unifying Receiver peripherals.
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
db_version 2.0
|
||||
db_capb backup
|
||||
|
||||
consolekit_running() {
|
||||
test -e /var/run/ConsoleKit/database
|
||||
}
|
||||
|
||||
systemd_running() {
|
||||
test -e /sys/fs/cgroup/systemd
|
||||
}
|
||||
|
||||
plugdev_group_exists() {
|
||||
getent group plugdev >/dev/null
|
||||
}
|
||||
|
||||
|
||||
# if not reconfiguring, and the right daemons are running,
|
||||
# no reason to do anything
|
||||
if test -z "$DEBCONF_RECONFIGURE"; then
|
||||
consolekit_running && exit 0
|
||||
systemd_running && exit 0
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
# update the question template
|
||||
if consolekit_running; then
|
||||
db_subst solaar/use_plugdev_group SEAT_DAEMON_STATUS "the ConsoleKit"
|
||||
elif systemd_running; then
|
||||
db_subst solaar/use_plugdev_group SEAT_DAEMON_STATUS "the systemd"
|
||||
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
|
||||
|
||||
exit 0
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# shamelessly copied from usbmuxd.postinst
|
||||
|
||||
# creating plugdev group if it's not already present on the system
|
||||
if ! getent group plugdev >/dev/null; then
|
||||
groupadd --system --force plugdev || addgroup --system plugdev
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
|
@ -0,0 +1,27 @@
|
|||
Template: solaar/use_plugdev_group
|
||||
Type: boolean
|
||||
Default: false
|
||||
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
|
||||
applied, either by the ConsoleKit or systemd daemon, to the current seat
|
||||
(logged-in user).
|
||||
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:
|
||||
.
|
||||
gpasswd --add <username> plugdev
|
||||
.
|
||||
For the group membership to take effect, the affected users have to log-out
|
||||
and log-in again.
|
|
@ -0,0 +1,39 @@
|
|||
# Allows non-root users to have raw access the Logitech Unifying USB Receiver
|
||||
# device. For development purposes, allowing users to write to the receiver is
|
||||
# potentially dangerous (e.g. perform firmware updates).
|
||||
|
||||
ACTION != "add", GOTO="solaar_end"
|
||||
SUBSYSTEM != "hidraw", GOTO="solaar_end"
|
||||
|
||||
# Unifying receiver
|
||||
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", GOTO="solaar_apply"
|
||||
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", GOTO="solaar_apply"
|
||||
|
||||
# Nano receiver, "Unifying ready"
|
||||
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", GOTO="solaar_apply"
|
||||
|
||||
GOTO="solaar_end"
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
LABEL="solaar_apply"
|
||||
|
||||
# don't apply to the paired devices, just the receivers
|
||||
DRIVERS=="logitech-djdevice", GOTO="solaar_end"
|
||||
|
||||
# if the package configuration does not want the plugdev group, don't change the
|
||||
# group and access mode
|
||||
PROGRAM="/usr/bin/debconf-show solaar", RESULT=="*use_plugdev_group: false*", GOTO="solaar_no_plugdev"
|
||||
MODE="0660", GROUP="plugdev"
|
||||
|
||||
LABEL="solaar_no_plugdev"
|
||||
# tags for systemd/consolekit, they will apply the right ACLs for seated users
|
||||
TAG+="uaccess", TAG+="udev-acl"
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
LABEL="solaar_end"
|
||||
# vim: ft=udevrules
|
Loading…
Reference in New Issue