unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31342] [PATCH 0/2] Enlightenment Desktop Service
@ 2018-05-02 16:44 Efraim Flashner
  2018-05-02 16:47 ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Efraim Flashner
  0 siblings, 1 reply; 8+ messages in thread
From: Efraim Flashner @ 2018-05-02 16:44 UTC (permalink / raw)
  To: 31342; +Cc: Efraim Flashner

These two patches create a usable desktop service for Enlightenment.
I've been running it for a few weeks while working out the kinks, and
almost everything works as expected. The default screen locker now
works, so as far as I'm concerned it seems ready for upstreaming.

Currently the remaining issue that I have is the language switcher
doesn't work. I can change the language flag at the bottom but it
currently doesn't affect the language typed in or the Caps->Meta
conversion.

Efraim Flashner (2):
  gnu: enlightenment: Fix setuid program locations.
  gnu: services: Add Enlightenment desktop service.

 doc/guix.texi                                 |  10 +-
 gnu/local.mk                                  |   1 +
 gnu/packages/enlightenment.scm                |   3 +-
 .../enlightenment-fix-setuid-path.patch       | 168 ++++++++++++++++++
 gnu/services/desktop.scm                      |  61 +++++++
 5 files changed, 237 insertions(+), 6 deletions(-)
 create mode 100644 gnu/packages/patches/enlightenment-fix-setuid-path.patch

-- 
2.17.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations.
  2018-05-02 16:44 [bug#31342] [PATCH 0/2] Enlightenment Desktop Service Efraim Flashner
@ 2018-05-02 16:47 ` Efraim Flashner
  2018-05-02 16:47   ` [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service Efraim Flashner
  2018-05-07 16:42   ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Efraim Flashner @ 2018-05-02 16:47 UTC (permalink / raw)
  To: 31342; +Cc: Efraim Flashner

* gnu/packages/enlightenment.scm (enlightenment)[source]: Add patch.
* gnu/packages/patches/enlightenment-fix-setuid-path.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/enlightenment.scm                |   3 +-
 .../enlightenment-fix-setuid-path.patch       | 168 ++++++++++++++++++
 3 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/enlightenment-fix-setuid-path.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index cfe698d3f..df8d22d09 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -644,6 +644,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-highlight-stages-add-gexp.patch	\
   %D%/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch	\
   %D%/packages/patches/emacs-source-date-epoch.patch		\
+  %D%/packages/patches/enlightenment-fix-setuid-path.patch	\
   %D%/packages/patches/erlang-man-path.patch			\
   %D%/packages/patches/eudev-rules-directory.patch		\
   %D%/packages/patches/evilwm-lost-focus-bug.patch		\
diff --git a/gnu/packages/enlightenment.scm b/gnu/packages/enlightenment.scm
index d6c11e4fe..54205978a 100644
--- a/gnu/packages/enlightenment.scm
+++ b/gnu/packages/enlightenment.scm
@@ -262,7 +262,8 @@ Libraries with some extra bells and whistles.")
                               name "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "16zydv7z94aw3rywmb9gr8ya85k7b75h22wng95lfx1x0y1yb0ad"))))
+                "16zydv7z94aw3rywmb9gr8ya85k7b75h22wng95lfx1x0y1yb0ad"))
+              (patches (search-patches "enlightenment-fix-setuid-path.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
diff --git a/gnu/packages/patches/enlightenment-fix-setuid-path.patch b/gnu/packages/patches/enlightenment-fix-setuid-path.patch
new file mode 100644
index 000000000..90e16d3e6
--- /dev/null
+++ b/gnu/packages/patches/enlightenment-fix-setuid-path.patch
@@ -0,0 +1,168 @@
+diff --git a/src/bin/e_auth.c b/src/bin/e_auth.c
+index 00b0e5d84..98ab4518f 100644
+--- a/src/bin/e_auth.c
++++ b/src/bin/e_auth.c
+@@ -9,8 +9,7 @@ e_auth_begin(char *passwd)
+ 
+    if (strlen(passwd) == 0) goto out;
+ 
+-   snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_ckpasswd",
+-            e_prefix_lib_get());
++   snprintf(buf, sizeof(buf), "/run/setuid-programs/enlightenment_ckpasswd");
+ 
+    exe = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_WRITE, NULL);
+    if (ecore_exe_send(exe, passwd, strlen(passwd)) != EINA_TRUE) goto out;
+diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c
+index 2bced6766..208e583ba 100644
+--- a/src/bin/e_backlight.c
++++ b/src/bin/e_backlight.c
+@@ -521,8 +521,8 @@ _bl_sys_level_set(double val)
+      }
+ //   fprintf(stderr, "SET: %1.3f\n", val);
+    snprintf(buf, sizeof(buf),
+-            "%s/enlightenment/utils/enlightenment_backlight %i %s",
+-            e_prefix_lib_get(), (int)(val * 1000.0), bl_sysval);
++            "/run/setuid-programs/enlightenment_backlight %i %s",
++            (int)(val * 1000.0), bl_sysval);
+    bl_sys_set_exe = ecore_exe_run(buf, NULL);
+ }
+ #endif  // HAVE_EEZE || __FreeBSD_kernel__
+diff --git a/src/bin/e_fm/e_fm_main_eeze.c b/src/bin/e_fm/e_fm_main_eeze.c
+index b7d9e3eba..d8a9eb82c 100644
+--- a/src/bin/e_fm/e_fm_main_eeze.c
++++ b/src/bin/e_fm/e_fm_main_eeze.c
+@@ -318,7 +318,7 @@ _e_fm_main_eeze_volume_eject(E_Volume *v)
+      {
+         char buf[PATH_MAX];
+ 
+-        snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_sys", eina_prefix_lib_get(pfx));
++        snprintf(buf, sizeof(buf), "/run/setuid-programs/enlightenment_sys");
+         eeze_disk_mount_wrapper_set(v->disk, buf);
+      }
+    v->guard = ecore_timer_loop_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_eject_timeout, v);
+@@ -512,7 +512,7 @@ _e_fm_main_eeze_volume_unmount(E_Volume *v)
+      {
+         char buf[PATH_MAX];
+ 
+-        snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_sys", eina_prefix_lib_get(pfx));
++        snprintf(buf, sizeof(buf), "/run/setuid-programs/enlightenment_sys");
+         eeze_disk_mount_wrapper_set(v->disk, buf);
+      }
+    v->guard = ecore_timer_loop_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_unmount_timeout, v);
+@@ -548,7 +548,7 @@ _e_fm_main_eeze_volume_mount(E_Volume *v)
+      {
+         char buf2[PATH_MAX];
+ 
+-        snprintf(buf2, sizeof(buf2), "%s/enlightenment/utils/enlightenment_sys", eina_prefix_lib_get(pfx));
++        snprintf(buf2, sizeof(buf2), "/run/setuid-programs/enlightenment_sys");
+         eeze_disk_mount_wrapper_set(v->disk, buf2);
+      }
+    v->guard = ecore_timer_loop_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_mount_timeout, v);
+diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
+index 6781a9b5a..8cd140f1b 100644
+--- a/src/bin/e_sys.c
++++ b/src/bin/e_sys.c
+@@ -653,20 +653,16 @@ _e_sys_cb_timer(void *data EINA_UNUSED)
+ 
+    e_init_status_set(_("Checking System Permissions"));
+    snprintf(buf, sizeof(buf),
+-            "%s/enlightenment/utils/enlightenment_sys -t halt",
+-            e_prefix_lib_get());
++            "/run/setuid-programs/enlightenment_sys -t halt");
+    _e_sys_halt_check_exe = ecore_exe_run(buf, NULL);
+    snprintf(buf, sizeof(buf),
+-            "%s/enlightenment/utils/enlightenment_sys -t reboot",
+-            e_prefix_lib_get());
++            "/run/setuid-programs/enlightenment_sys -t reboot");
+    _e_sys_reboot_check_exe = ecore_exe_run(buf, NULL);
+    snprintf(buf, sizeof(buf),
+-            "%s/enlightenment/utils/enlightenment_sys -t suspend",
+-            e_prefix_lib_get());
++            "/run/setuid-programs/enlightenment_sys -t suspend");
+    _e_sys_suspend_check_exe = ecore_exe_run(buf, NULL);
+    snprintf(buf, sizeof(buf),
+-            "%s/enlightenment/utils/enlightenment_sys -t hibernate",
+-            e_prefix_lib_get());
++            "/run/setuid-programs/enlightenment_sys -t hibernate");
+    _e_sys_hibernate_check_exe = ecore_exe_run(buf, NULL);
+    return ECORE_CALLBACK_CANCEL;
+ }
+@@ -1079,8 +1075,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
+         /* shutdown -h now */
+         if (e_util_immortal_check()) return 0;
+         snprintf(buf, sizeof(buf),
+-                 "%s/enlightenment/utils/enlightenment_sys halt",
+-                 e_prefix_lib_get());
++                 "/run/setuid-programs/enlightenment_sys halt");
+         if (_e_sys_exe)
+           {
+              if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
+@@ -1114,8 +1109,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
+         /* shutdown -r now */
+         if (e_util_immortal_check()) return 0;
+         snprintf(buf, sizeof(buf),
+-                 "%s/enlightenment/utils/enlightenment_sys reboot",
+-                 e_prefix_lib_get());
++                 "/run/setuid-programs/enlightenment_sys reboot");
+         if (_e_sys_exe)
+           {
+              if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
+@@ -1148,8 +1142,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
+       case E_SYS_SUSPEND:
+         /* /etc/acpi/sleep.sh force */
+         snprintf(buf, sizeof(buf),
+-                 "%s/enlightenment/utils/enlightenment_sys suspend",
+-                 e_prefix_lib_get());
++                 "/run/setuid-programs/enlightenment_sys suspend");
+         if (_e_sys_exe)
+           {
+              if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
+@@ -1208,8 +1201,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
+       case E_SYS_HIBERNATE:
+         /* /etc/acpi/hibernate.sh force */
+         snprintf(buf, sizeof(buf),
+-                 "%s/enlightenment/utils/enlightenment_sys hibernate",
+-                 e_prefix_lib_get());
++                 "/run/setuid-programs/enlightenment_sys hibernate");
+         if (_e_sys_exe)
+           {
+              if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
+diff --git a/src/modules/bluez4/e_mod_main.c b/src/modules/bluez4/e_mod_main.c
+index 4b5148634..47d34b07f 100644
+--- a/src/modules/bluez4/e_mod_main.c
++++ b/src/modules/bluez4/e_mod_main.c
+@@ -49,8 +49,8 @@ _ebluez_l2ping_poller(void *data EINA_UNUSED)
+ 
+    if (tmp)
+      {
+-        eina_strbuf_append_printf(buf, "%s/enlightenment/utils/enlightenment_sys l2ping %s",
+-				  e_prefix_lib_get(), tmp);
++        eina_strbuf_append_printf(buf, "/run/setuid-programs/enlightenment_sys l2ping %s",
++				  tmp);
+ 	autolock_exe = ecore_exe_run(eina_strbuf_string_get(buf), NULL);
+      }
+ 
+@@ -692,8 +692,7 @@ e_modapi_init(E_Module *m)
+    autolock_desklock = ecore_event_handler_add(E_EVENT_DESKLOCK, _ebluez_desklock, NULL);
+ 
+    buf = eina_strbuf_new();
+-   eina_strbuf_append_printf(buf, "%s/enlightenment/utils/enlightenment_sys -t l2ping",
+-			     e_prefix_lib_get());
++   eina_strbuf_append_printf(buf, "/run/setuid-programs/enlightenment_sys -t l2ping");
+    autolock_exe = ecore_exe_run(eina_strbuf_string_get(buf), NULL);
+    eina_strbuf_free(buf);
+ 
+diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c
+index f4ba259b6..ae228bae3 100644
+--- a/src/modules/cpufreq/e_mod_main.c
++++ b/src/modules/cpufreq/e_mod_main.c
+@@ -1450,8 +1450,7 @@ e_modapi_init(E_Module *m)
+      }
+    E_CONFIG_LIMIT(cpufreq_config->poll_interval, 1, 1024);
+ 
+-   snprintf(buf, sizeof(buf), "%s/%s/freqset",
+-            e_module_dir_get(m), MODULE_ARCH);
++   snprintf(buf, sizeof(buf), "/run/setuid-programs/freqset");
+    cpufreq_config->set_exe_path = strdup(buf);
+    
+    if (stat(buf, &st) < 0)
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service.
  2018-05-02 16:47 ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Efraim Flashner
@ 2018-05-02 16:47   ` Efraim Flashner
  2018-05-07 16:49     ` Ludovic Courtès
  2018-05-07 16:42   ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Efraim Flashner @ 2018-05-02 16:47 UTC (permalink / raw)
  To: 31342; +Cc: Efraim Flashner

* gnu/services/desktop.scm (<enlightenment-desktop-configuration>,
enlightenment-desktop-service-type): New variables.
(enlightenment-desktop-service): New public variable.
* doc/guix.texi (Desktop Services): Document the service.
---
 doc/guix.texi            | 10 +++----
 gnu/services/desktop.scm | 61 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index dc9894173..4fd3464ad 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12584,11 +12584,11 @@ field of an @code{operating-system} declaration (@pxref{operating-system
 Reference, @code{services}}).
 
 Additionally, the @code{gnome-desktop-service},
-@code{xfce-desktop-service} and @code{mate-desktop-service}
-procedures can add GNOME, XFCE and/or MATE to a system.
-To ``add GNOME'' means that system-level services like the
-backlight adjustment helpers and the power management utilities are
-added to the system, extending @code{polkit} and @code{dbus}
+@code{xfce-desktop-service}, @code{mate-desktop-service} and
+@code{enlightenment-desktop-service} procedures can add GNOME, XFCE, MATE
+and/or Enlightenment to a system.  To ``add GNOME'' means that system-level
+services like the backlight adjustment helpers and the power management
+utilities are added to the system, extending @code{polkit} and @code{dbus}
 appropriately, allowing GNOME to operate with elevated privileges on a
 limited number of special-purpose system interfaces.  Additionally,
 adding a service made by @code{gnome-desktop-service} adds the GNOME
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 517d5d3ef..605d06c23 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
+;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@
   #:use-module (gnu services networking)
   #:use-module ((gnu system file-systems)
                 #:select (%elogind-file-systems))
+  #:use-module (gnu system)
   #:use-module (gnu system shadow)
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
@@ -44,9 +46,11 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages mate)
+  #:use-module (gnu packages enlightenment)
   #:use-module (guix records)
   #:use-module (guix packages)
   #:use-module (guix store)
+  #:use-module (guix utils)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
@@ -96,6 +100,11 @@
 
             x11-socket-directory-service
 
+            enlightenment-desktop-configuration
+            enlightenment-desktop-configuration?
+            enlightenment-desktop-service
+            enlightenment-desktop-service-type
+
             %desktop-services))
 
 ;;; Commentary:
@@ -899,6 +908,58 @@ with the administrator's password."
                         (let ((directory "/tmp/.X11-unix"))
                           (mkdir-p directory)
                           (chmod directory #o777))))))
+\f
+;;;
+;;; Enlightenment desktop service.
+;;;
+
+(define-record-type* <enlightenment-desktop-configuration>
+  enlightenment-desktop-configuration
+  make-enlightenment-desktop-configuration
+  enlightenment-desktop-configuration
+  (enlightenment enlightenment-package (default enlightenment)))
+
+(define (enlightenment-setuid-programs enlightenment-desktop-configuration)
+  (match-record enlightenment-desktop-configuration
+                <enlightenment-desktop-configuration>
+                (enlightenment)
+    (list (file-append enlightenment
+                       "/lib/enlightenment/utils/enlightenment_sys")
+          (file-append enlightenment
+                       "/lib/enlightenment/utils/enlightenment_backlight")
+          ;; TODO: Move this binary to a screen-locker service.
+          (file-append enlightenment
+                       "/lib/enlightenment/utils/enlightenment_ckpasswd")
+          (file-append enlightenment
+                       (string-append
+                         "/lib/enlightenment/modules/cpufreq/linux-gnu-"
+                         (string-drop-right (%current-system) 6) ; drop '-linux'
+                         "-"
+                         (version-major+minor (package-version enlightenment))
+                         "/freqset")))))
+
+(define enlightenment-desktop-service-type
+  (service-type
+   (name 'enlightenment-desktop)
+   (extensions
+    (list (service-extension dbus-root-service-type
+                             (compose list
+                                      (package-direct-input-selector
+                                       "efl")
+                                      enlightenment-package))
+          (service-extension setuid-program-service-type
+                             enlightenment-setuid-programs)
+          (service-extension profile-service-type
+                             (compose list
+                                      enlightenment-package))))))
+
+(define* (enlightenment-desktop-service
+           #:key (config (enlightenment-desktop-configuration)))
+  "Return a service that adds the @code{enlightenment} package to the system
+profile, and extends dbus with the ability for @code{efl} to generate
+thumbnails and makes setuid the programs which enlightenment expects to have
+their setuid bit set."
+  (service enlightenment-desktop-service-type config))
 
 \f
 ;;;
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations.
  2018-05-02 16:47 ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Efraim Flashner
  2018-05-02 16:47   ` [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service Efraim Flashner
@ 2018-05-07 16:42   ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2018-05-07 16:42 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 31342

Efraim Flashner <efraim@flashner.co.il> skribis:

> * gnu/packages/enlightenment.scm (enlightenment)[source]: Add patch.
> * gnu/packages/patches/enlightenment-fix-setuid-path.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register it.

LGTM!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service.
  2018-05-02 16:47   ` [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service Efraim Flashner
@ 2018-05-07 16:49     ` Ludovic Courtès
  2018-05-07 19:03       ` Efraim Flashner
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-05-07 16:49 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 31342

Efraim Flashner <efraim@flashner.co.il> skribis:

> * gnu/services/desktop.scm (<enlightenment-desktop-configuration>,
> enlightenment-desktop-service-type): New variables.
> (enlightenment-desktop-service): New public variable.
> * doc/guix.texi (Desktop Services): Document the service.

In guix.texi, could you document ‘enlightenment-desktop-service-type’
and ‘enlightenment-desktop-configuration’?

[...]

> +(define-record-type* <enlightenment-desktop-configuration>
> +  enlightenment-desktop-configuration
> +  make-enlightenment-desktop-configuration
> +  enlightenment-desktop-configuration
> +  (enlightenment enlightenment-package (default enlightenment)))

Actually, unless you expect more configuration elements to be added to
this record eventually, you might be better off without a record and
simply using the package as the value for that service.

WDYT?

> +(define (enlightenment-setuid-programs enlightenment-desktop-configuration)
> +  (match-record enlightenment-desktop-configuration
> +                <enlightenment-desktop-configuration>
> +                (enlightenment)
> +    (list (file-append enlightenment
> +                       "/lib/enlightenment/utils/enlightenment_sys")
> +          (file-append enlightenment
> +                       "/lib/enlightenment/utils/enlightenment_backlight")
> +          ;; TODO: Move this binary to a screen-locker service.
> +          (file-append enlightenment
> +                       "/lib/enlightenment/utils/enlightenment_ckpasswd")

Perhaps enlightenment_ckpasswd needs a PAM entry as well, like
‘screen-locker-service-type’ does?

> +          (file-append enlightenment
> +                       (string-append
> +                         "/lib/enlightenment/modules/cpufreq/linux-gnu-"
> +                         (string-drop-right (%current-system) 6) ; drop '-linux'

Rather:

  (match (string-tokenize (%current-system) (char-set-complement (char-set #\-)))
    ((arch "linux") (string-append "linux-gnu-" arch))
    ((arch "gnu")   (string-append "gnu-" arch)))

> +(define* (enlightenment-desktop-service
> +           #:key (config (enlightenment-desktop-configuration)))
> +  "Return a service that adds the @code{enlightenment} package to the system
> +profile, and extends dbus with the ability for @code{efl} to generate
> +thumbnails and makes setuid the programs which enlightenment expects to have
> +their setuid bit set."
> +  (service enlightenment-desktop-service-type config))

Not needed!  :-)

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service.
  2018-05-07 16:49     ` Ludovic Courtès
@ 2018-05-07 19:03       ` Efraim Flashner
  2018-05-08 13:24         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Efraim Flashner @ 2018-05-07 19:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31342


[-- Attachment #1.1: Type: text/plain, Size: 3480 bytes --]

On Mon, May 07, 2018 at 06:49:43PM +0200, Ludovic Courtès wrote:
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > * gnu/services/desktop.scm (<enlightenment-desktop-configuration>,
> > enlightenment-desktop-service-type): New variables.
> > (enlightenment-desktop-service): New public variable.
> > * doc/guix.texi (Desktop Services): Document the service.
> 
> In guix.texi, could you document ‘enlightenment-desktop-service-type’
> and ‘enlightenment-desktop-configuration’?
> 
> [...]
> 
> > +(define-record-type* <enlightenment-desktop-configuration>
> > +  enlightenment-desktop-configuration
> > +  make-enlightenment-desktop-configuration
> > +  enlightenment-desktop-configuration
> > +  (enlightenment enlightenment-package (default enlightenment)))
> 
> Actually, unless you expect more configuration elements to be added to
> this record eventually, you might be better off without a record and
> simply using the package as the value for that service.
> 
> WDYT?
> 
> > +(define (enlightenment-setuid-programs enlightenment-desktop-configuration)
> > +  (match-record enlightenment-desktop-configuration
> > +                <enlightenment-desktop-configuration>
> > +                (enlightenment)
> > +    (list (file-append enlightenment
> > +                       "/lib/enlightenment/utils/enlightenment_sys")
> > +          (file-append enlightenment
> > +                       "/lib/enlightenment/utils/enlightenment_backlight")
> > +          ;; TODO: Move this binary to a screen-locker service.
> > +          (file-append enlightenment
> > +                       "/lib/enlightenment/utils/enlightenment_ckpasswd")
> 
> Perhaps enlightenment_ckpasswd needs a PAM entry as well, like
> ‘screen-locker-service-type’ does?
> 

I'm not sure, enlightenment's screen locker code was refactored in
0.22.2 so that it would behave identically on Linux and BSD, and I'm not
sure that the BSDs use PAM, and it seems to with as-is.

> > +          (file-append enlightenment
> > +                       (string-append
> > +                         "/lib/enlightenment/modules/cpufreq/linux-gnu-"
> > +                         (string-drop-right (%current-system) 6) ; drop '-linux'
> 
> Rather:
> 
>   (match (string-tokenize (%current-system) (char-set-complement (char-set #\-)))
>     ((arch "linux") (string-append "linux-gnu-" arch))
>     ((arch "gnu")   (string-append "gnu-" arch)))
> 
> > +(define* (enlightenment-desktop-service
> > +           #:key (config (enlightenment-desktop-configuration)))
> > +  "Return a service that adds the @code{enlightenment} package to the system
> > +profile, and extends dbus with the ability for @code{efl} to generate
> > +thumbnails and makes setuid the programs which enlightenment expects to have
> > +their setuid bit set."
> > +  (service enlightenment-desktop-service-type config))
> 
> Not needed!  :-)
> 
> Thank you,
> Ludo’.

I looked at the xfce service especially, and it actually has the same
fields and declarations as enlightenment. I'd like to leave the option
in place to add '(enlightenment-desktop-service)' to an OS-config since
it is then identical to the other desktop services we have.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: 0001-gnu-services-Add-Enlightenment-desktop-service.patch --]
[-- Type: text/plain, Size: 6989 bytes --]

From 197db9e742508958a93a0ce606bd8a770f103745 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Sat, 10 Mar 2018 22:24:00 +0200
Subject: [PATCH 1/2] gnu: services: Add Enlightenment desktop service.

* gnu/services/desktop.scm (<enlightenment-desktop-configuration>,
enlightenment-desktop-service-type): New variables.
(enlightenment-desktop-service): New public variable.
* doc/guix.texi (Desktop Services): Document the service.
---
 doc/guix.texi            | 15 ++++++----
 gnu/services/desktop.scm | 64 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index dc9894173..fca2c8e13 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12584,11 +12584,11 @@ field of an @code{operating-system} declaration (@pxref{operating-system
 Reference, @code{services}}).
 
 Additionally, the @code{gnome-desktop-service},
-@code{xfce-desktop-service} and @code{mate-desktop-service}
-procedures can add GNOME, XFCE and/or MATE to a system.
-To ``add GNOME'' means that system-level services like the
-backlight adjustment helpers and the power management utilities are
-added to the system, extending @code{polkit} and @code{dbus}
+@code{xfce-desktop-service}, @code{mate-desktop-service} and
+@code{enlightenment-desktop-service} procedures can add GNOME, XFCE, MATE
+and/or Enlightenment to a system.  To ``add GNOME'' means that system-level
+services like the backlight adjustment helpers and the power management
+utilities are added to the system, extending @code{polkit} and @code{dbus}
 appropriately, allowing GNOME to operate with elevated privileges on a
 limited number of special-purpose system interfaces.  Additionally,
 adding a service made by @code{gnome-desktop-service} adds the GNOME
@@ -12601,7 +12601,10 @@ To ``add MATE'' means that @code{polkit} and @code{dbus} are extended
 appropriately, allowing MATE to operate with elevated privileges on a
 limited number of special-purpose system interfaces.  Additionally,
 adding a service made by @code{mate-desktop-service} adds the MATE
-metapackage to the system profile.
+metapackage to the system profile.  ``Adding ENLIGHTENMENT'' means that
+@code{dbus} is extended appropriately, and several of Enlightenment's binaries
+are set as setuid, allowing Enlightenment's screen locker and other
+functionality to work as expetected.
 
 The desktop environments in Guix use the Xorg display server by
 default.  If you'd like to use the newer display server protocol
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 517d5d3ef..74073fab9 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
+;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@
   #:use-module (gnu services networking)
   #:use-module ((gnu system file-systems)
                 #:select (%elogind-file-systems))
+  #:use-module (gnu system)
   #:use-module (gnu system shadow)
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
@@ -44,9 +46,11 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages mate)
+  #:use-module (gnu packages enlightenment)
   #:use-module (guix records)
   #:use-module (guix packages)
   #:use-module (guix store)
+  #:use-module (guix utils)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
@@ -96,6 +100,11 @@
 
             x11-socket-directory-service
 
+            enlightenment-desktop-configuration
+            enlightenment-desktop-configuration?
+            enlightenment-desktop-service
+            enlightenment-desktop-service-type
+
             %desktop-services))
 
 ;;; Commentary:
@@ -899,6 +908,61 @@ with the administrator's password."
                         (let ((directory "/tmp/.X11-unix"))
                           (mkdir-p directory)
                           (chmod directory #o777))))))
+\f
+;;;
+;;; Enlightenment desktop service.
+;;;
+
+(define-record-type* <enlightenment-desktop-configuration>
+  enlightenment-desktop-configuration
+  make-enlightenment-desktop-configuration
+  enlightenment-desktop-configuration
+  (enlightenment enlightenment-package (default enlightenment)))
+
+(define (enlightenment-setuid-programs enlightenment-desktop-configuration)
+  (match-record enlightenment-desktop-configuration
+                <enlightenment-desktop-configuration>
+                (enlightenment)
+    (list (file-append enlightenment
+                       "/lib/enlightenment/utils/enlightenment_sys")
+          (file-append enlightenment
+                       "/lib/enlightenment/utils/enlightenment_backlight")
+          ;; TODO: Move this binary to a screen-locker service.
+          (file-append enlightenment
+                       "/lib/enlightenment/utils/enlightenment_ckpasswd")
+          (file-append enlightenment
+                       (string-append
+                         "/lib/enlightenment/modules/cpufreq/"
+                         (match (string-tokenize (%current-system)
+                                                 (char-set-complement (char-set #\-)))
+                                ((arch "linux") (string-append "linux-gnu-" arch))
+                                ((arch "gnu")   (string-append "gnu-" arch)))
+                         "-"
+                         (version-major+minor (package-version enlightenment))
+                         "/freqset")))))
+
+(define enlightenment-desktop-service-type
+  (service-type
+   (name 'enlightenment-desktop)
+   (extensions
+    (list (service-extension dbus-root-service-type
+                             (compose list
+                                      (package-direct-input-selector
+                                       "efl")
+                                      enlightenment-package))
+          (service-extension setuid-program-service-type
+                             enlightenment-setuid-programs)
+          (service-extension profile-service-type
+                             (compose list
+                                      enlightenment-package))))))
+
+(define* (enlightenment-desktop-service
+           #:key (config (enlightenment-desktop-configuration)))
+  "Return a service that adds the @code{enlightenment} package to the system
+profile, and extends dbus with the ability for @code{efl} to generate
+thumbnails and makes setuid the programs which enlightenment needs to function
+as expected."
+  (service enlightenment-desktop-service-type config))
 
 \f
 ;;;
-- 
2.17.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service.
  2018-05-07 19:03       ` Efraim Flashner
@ 2018-05-08 13:24         ` Ludovic Courtès
  2018-05-13 15:36           ` Efraim Flashner
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-05-08 13:24 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 31342

Hello!

Efraim Flashner <efraim@flashner.co.il> skribis:

> On Mon, May 07, 2018 at 06:49:43PM +0200, Ludovic Courtès wrote:

[...]

>> Perhaps enlightenment_ckpasswd needs a PAM entry as well, like
>> ‘screen-locker-service-type’ does?
>> 
>
> I'm not sure, enlightenment's screen locker code was refactored in
> 0.22.2 so that it would behave identically on Linux and BSD, and I'm not
> sure that the BSDs use PAM, and it seems to with as-is.

If you confirm it works as-is, that’s fine!

>> > +(define* (enlightenment-desktop-service
>> > +           #:key (config (enlightenment-desktop-configuration)))
>> > +  "Return a service that adds the @code{enlightenment} package to the system
>> > +profile, and extends dbus with the ability for @code{efl} to generate
>> > +thumbnails and makes setuid the programs which enlightenment expects to have
>> > +their setuid bit set."
>> > +  (service enlightenment-desktop-service-type config))
>> 
>> Not needed!  :-)
>> 
>> Thank you,
>> Ludo’.
>
> I looked at the xfce service especially, and it actually has the same
> fields and declarations as enlightenment.

Sounds good.

> I'd like to leave the option in place to add
> '(enlightenment-desktop-service)' to an OS-config since it is then
> identical to the other desktop services we have.

This style has been (informally, I admit) deprecated since we introduced
the ‘service’ form.  The recommended way is to write:

  (service enlightenment-service-type)

I agree it’s slightly more verbose, but it’s more “transparent.”

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service.
  2018-05-08 13:24         ` Ludovic Courtès
@ 2018-05-13 15:36           ` Efraim Flashner
  0 siblings, 0 replies; 8+ messages in thread
From: Efraim Flashner @ 2018-05-13 15:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31342

[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]

On Tue, May 08, 2018 at 03:24:59PM +0200, Ludovic Courtès wrote:
> Hello!
> 
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > On Mon, May 07, 2018 at 06:49:43PM +0200, Ludovic Courtès wrote:
> 
> [...]
> 
> >> Perhaps enlightenment_ckpasswd needs a PAM entry as well, like
> >> ‘screen-locker-service-type’ does?
> >> 
> >
> > I'm not sure, enlightenment's screen locker code was refactored in
> > 0.22.2 so that it would behave identically on Linux and BSD, and I'm not
> > sure that the BSDs use PAM, and it seems to with as-is.
> 
> If you confirm it works as-is, that’s fine!
> 
> >> > +(define* (enlightenment-desktop-service
> >> > +           #:key (config (enlightenment-desktop-configuration)))
> >> > +  "Return a service that adds the @code{enlightenment} package to the system
> >> > +profile, and extends dbus with the ability for @code{efl} to generate
> >> > +thumbnails and makes setuid the programs which enlightenment expects to have
> >> > +their setuid bit set."
> >> > +  (service enlightenment-desktop-service-type config))
> >> 
> >> Not needed!  :-)
> >> 
> >> Thank you,
> >> Ludo’.
> >
> > I looked at the xfce service especially, and it actually has the same
> > fields and declarations as enlightenment.
> 
> Sounds good.
> 
> > I'd like to leave the option in place to add
> > '(enlightenment-desktop-service)' to an OS-config since it is then
> > identical to the other desktop services we have.
> 
> This style has been (informally, I admit) deprecated since we introduced
> the ‘service’ form.  The recommended way is to write:
> 
>   (service enlightenment-service-type)
> 
> I agree it’s slightly more verbose, but it’s more “transparent.”
> 
> Thanks,
> Ludo’.

I think I have it this time. No 'enlightenment-desktop-service', yes
'enlightenment-desktop-service-type', which takes a configure option of
an enlightenment package. I moved the description from up to the
service-type and added a "table" detailing all the configure options
available.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-13 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 16:44 [bug#31342] [PATCH 0/2] Enlightenment Desktop Service Efraim Flashner
2018-05-02 16:47 ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Efraim Flashner
2018-05-02 16:47   ` [bug#31342] [PATCH 2/2] gnu: services: Add Enlightenment desktop service Efraim Flashner
2018-05-07 16:49     ` Ludovic Courtès
2018-05-07 19:03       ` Efraim Flashner
2018-05-08 13:24         ` Ludovic Courtès
2018-05-13 15:36           ` Efraim Flashner
2018-05-07 16:42   ` [bug#31342] [PATCH 1/2] gnu: enlightenment: Fix setuid program locations Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).