Subject: Re: [bug#40753] gnu: spacefm: Add dependencies for extra functionality.

From: Raghav Gururajan <[email-masked]>
Date: Mon, 27 Apr 2020 02:29:56 -0400

Hi Jan!

> >>>HERE<<<  
> 
> > * gnu/packages/lxde.scm (spacefm): Fix privilege management and icons.  
> 
> Please move this remark:
> 
> > This commit contains changes that were accidentally left out in
> > commit bf37b49cdd345bcedeb7142f61968d3a6e15e8d8.  
> 
> beteen subject and "* gnu/packages/lxde", so to >>>HERE<<<

Sure.

> >      (arguments
> > -     `(#:configure-flags (list (string-append "--with-bash-path="
> > -                                              (assoc-ref %build-inputs
> > "bash")
> > -                                              "/bin/bash")
> > -                               (string-append "--sysconfdir="
> > -                                              (assoc-ref %outputs "out")
> > -                                              "/etc"))))
> > +     `(#:phases
> > +       (modify-phases %standard-phases
> > +         (add-after 'unpack 'patch-spacefm-conf
> > +           (lambda* (#:key inputs #:allow-other-keys)
> > +             (substitute* "etc/spacefm.conf"
> > +               (("#terminal_su=/bin/su")
> > +                (string-append "terminal_su="
> > +                               (string-append (assoc-ref inputs "sudo")
> > +                                              "/bin/sudo"))))  
> 
> Does this work; SU is not SUDO?  Also, I don't see how <sudo>/bin/sudo
> would work.  When I run this
> 
>     $(guix build sudo)/bin/sudo 
> 
> I get
> 
>     sudo: /gnu/store/l320ig872ny66d1yi6v7n4zb93iz50dx-sudo-1.8.31p1/bin/sudo
> must be owned by uid 0 and have the setuid bit set
> 
> Am I missing something?

The option just has the name "su". It can be sudo too. I wouldn't worry about
this terminal_su option. This is just has to be set, so that spacefm doesn't
throw "no valid program found" error, now and then, because of default FHS path.
SpaceFM primarily uses graphical_su, which has been set to 'ktsuss'.

> > +             (substitute* "etc/spacefm.conf"
> > +               (("#graphical_su=/usr/bin/gksu")
> > +                (string-append "graphical_su="
> > +                               (string-append (assoc-ref inputs "ktsuss")
> > +                                              "/bin/ktsuss"))))
> > +             #t)))  
> 
> Changing the default configurations does not seem to work for me.  When
> I select
> 
>     /File/Root Window
> 
> there is a pop-up that says: Please configure a valid Terminal SU
> command.  Does it work for You?

This is exactly the error I was talking about above. Once we apply this patch,
the error appearing stops and ktsuss will pop right up.

> 
> > +       #:configure-flags (list   
>                                  ^
> Trailing space.

Thanks! I have attached revised patch with this email.

Regards,
RG.
>From 636d358dc3290433b929ebd72ad087dbfa50c8a5 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Mon, 27 Apr 2020 02:27:16 -0400
Subject: [PATCH] gnu: spacefm: Fix privilege management.

* gnu/packages/lxde.scm (spacefm): Fix privilege management.
---
 gnu/packages/lxde.scm | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/lxde.scm b/gnu/packages/lxde.scm
index 9de96a21cb..8b9759bc9c 100644
--- a/gnu/packages/lxde.scm
+++ b/gnu/packages/lxde.scm
@@ -27,6 +27,7 @@
 
 (define-module (gnu packages lxde)
   #:use-module (gnu packages)
+  #:use-module (gnu packages admin)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages disk)
@@ -288,21 +289,42 @@ with freedesktop.org standard.")
        ("gtk+" ,gtk+)
        ("ifuse" ,ifuse)
        ("jmtpfs" ,jmtpfs)
+       ("ktsuss" ,ktsuss)
        ("libx11" ,libx11)
        ("lsof" ,lsof)
        ("pango" ,pango)
        ("shared-mime-info" ,shared-mime-info)
        ("startup-notification" ,startup-notification)
+       ("sudo" ,sudo)
        ("udevil" ,udevil)
        ("util-linux" ,util-linux)
        ("wget" ,wget)))
     (arguments
-     `(#:configure-flags (list (string-append "--with-bash-path="
-                                              (assoc-ref %build-inputs "bash")
-                                              "/bin/bash")
-                               (string-append "--sysconfdir="
-                                              (assoc-ref %outputs "out")
-                                              "/etc"))))
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-spacefm-conf
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "etc/spacefm.conf"
+               (("#terminal_su=/bin/su")
+                (string-append "terminal_su="
+                               (string-append (assoc-ref inputs "sudo")
+                                              "/bin/sudo"))))
+             (substitute* "etc/spacefm.conf"
+               (("#graphical_su=/usr/bin/gksu")
+                (string-append "graphical_su="
+                               (string-append (assoc-ref inputs "ktsuss")
+                                              "/bin/ktsuss"))))
+             #t)))
+       #:configure-flags (list
+                          (string-append "--with-preferable-sudo="
+                                         (assoc-ref %build-inputs "ktsuss")
+                                         "/bin/ktsuss")
+                          (string-append "--with-bash-path="
+                                         (assoc-ref %build-inputs "bash")
+                                         "/bin/bash")
+                          (string-append "--sysconfdir="
+                                         (assoc-ref %outputs "out")
+                                         "/etc"))))
     (home-page "https://ignorantguru.github.io/spacefm/")
     (synopsis "Multi-panel tabbed file manager")
     (description "SpaceFM is a graphical, multi-panel, tabbed file manager
-- 
2.26.2