diff --git a/packaging/debian/solaar.config b/packaging/debian/solaar.config index 0e1076dd..14f16549 100755 --- a/packaging/debian/solaar.config +++ b/packaging/debian/solaar.config @@ -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 diff --git a/packaging/debian/solaar.postinst b/packaging/debian/solaar.postinst new file mode 100644 index 00000000..178d865d --- /dev/null +++ b/packaging/debian/solaar.postinst @@ -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# diff --git a/packaging/debian/solaar.templates b/packaging/debian/solaar.templates index e46e2a87..cb67ddf5 100644 --- a/packaging/debian/solaar.templates +++ b/packaging/debian/solaar.templates @@ -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 plugdev - . For the group membership to take effect, the affected users have to log-out and log-in again.