[PATCH]: Make more services one-shot

  • Open
  • quality assurance status badge
Details
2 participants
  • Efraim Flashner
  • Ludovic Courtès
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 20 Nov 2019 20:45
(address . guix-patches@gnu.org)
20191120194544.GV15074@E5400
After changing the sysctl service to use one-shot I found 3 more that
look like they'd be good choices.


--
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
From 64126d7a861a415bf4faafb30687928742db4f2b Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Wed, 20 Nov 2019 21:36:56 +0200
Subject: [PATCH 1/3] services: host-name: Make service one-shot.

* gnu/services/base.scm (host-name-service-type): Remove 'respawn?'
keyword from shepherd-service-type, add 'one-shot?'.
---
gnu/services/base.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b1eff89ecc..7cd42bb30a 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -705,7 +705,7 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
(provision '(host-name))
(start #~(lambda _
(sethostname #$name)))
- (respawn? #f)))))
+ (one-shot? #t)))))
(define (host-name-service name)
"Return a service that sets the host name to @var{name}."
--
2.24.0
From 6c13de1914503afb3533a0fe032b4db767011874 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Wed, 20 Nov 2019 21:38:18 +0200
Subject: [PATCH 2/3] services: console-keymap-service-type: Make service
one-shot.

* gnu/services/base.scm (console-keymap-service-type): Remove 'respawn?'
keyword from shepherd-service-type, add 'one-shot?'.
---
gnu/services/base.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 7cd42bb30a..022bb501ba 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -746,7 +746,7 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
(start #~(lambda _
(zero? (system* #$(file-append kbd "/bin/loadkeys")
#$@files))))
- (respawn? #f)))))
+ (one-shot? #t)))))
(define-deprecated (console-keymap-service #:rest files)
#f
--
2.24.0
From 153d02caa1333788df435ca4ffbf915c50d9cb01 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Wed, 20 Nov 2019 21:40:50 +0200
Subject: [PATCH 3/3] services: console-font-shepherd-services: Make service
one-shot.

* gnu/services/base.scm (console-font-shepherd-services): Remove 'stop'
and 'respawn?' keywords from shepherd-service-type, add 'one-shot?'.
---
gnu/services/base.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Toggle diff (16 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 022bb501ba..cef2d4cb2b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -797,8 +797,7 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
"-C" #$device #$font))
((0 71) #t)
(else #f))))
- (stop #~(const #t))
- (respawn? #f)))))
+ (one-shot? #t)))))
tty+font))
(define console-font-service-type
--
2.24.0
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl3Vl+cACgkQQarn3Mo9
g1GP6Q//R+/vw7GU01J38iceLEqUz9gLpUcDqwze8PIRS78yr1GYKuk4BLcstQX7
2/0Xpj8BTH0fMKtwubErk/n7VaqLTR5LVa05TcbOXql+8UgJ3fXHzOfONgkcg8c5
feSU7zuXSI3t5Oo3jgriB68025g4sdyu3DUEE/2RAvclBdZx3216vJeu5JriUTYQ
FryUpZqX0T60TfDIIEzFYomvS2WSe8Hl2TJDSJEHrlv5tqxdk3CMPF31hh+afO5T
fOAy+Z0ePesl9U1I0ajhh5abm6sM8In1awYUpHnB8ArCnJuKR1H74AdXYZ6wm1aH
lGlukQ32zPe2Hy/x+c0o+qOyVXgH+DzCFvyxVoqb7e1eW6ljgoq74HGsqSH3vyzZ
tr8GGUggDsJVXPQEm1lBbc8Wa6OeDZhKYeurYXZS0hsaeMSHV2m3K9o/Wut03rjQ
S3KC/9djHV2XcAHUWENTaYE/QRe6/ns/oOTfIPS/ceC7eB3rIsBOr36451lDpxfI
t75wN3CfTIevHJEZ6s4Idbn8drsJziOP0sdckVQhFvtXyxJ2/nX9jmCqg9DnWZAg
73TCMNIzgDB5KR44arGGd5GjBEygCYdId8JwtRAxr3DDi2/DmpWH2NRUdTmuABsW
k0EllW7gOv6D7z6Q+fq8zzwMqM6JMnlDb751Wdb2VpnE+B6HVyQ=
=4XBE
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 20 Nov 2019 20:54
(address . 38304@debbugs.gnu.org)
20191120195408.GW15074@E5400
On Wed, Nov 20, 2019 at 09:45:44PM +0200, Efraim Flashner wrote:
Toggle quote (4 lines)
> After changing the sysctl service to use one-shot I found 3 more that
> look like they'd be good choices.
>

Actually, it looks like agetty and mingetty both rely on the host-name
service, so that one doesn't look like a good choice after all.

Toggle quote (90 lines)
> From 64126d7a861a415bf4faafb30687928742db4f2b Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <efraim@flashner.co.il>
> Date: Wed, 20 Nov 2019 21:36:56 +0200
> Subject: [PATCH 1/3] services: host-name: Make service one-shot.
>
> * gnu/services/base.scm (host-name-service-type): Remove 'respawn?'
> keyword from shepherd-service-type, add 'one-shot?'.
> ---
> gnu/services/base.scm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index b1eff89ecc..7cd42bb30a 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -705,7 +705,7 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
> (provision '(host-name))
> (start #~(lambda _
> (sethostname #$name)))
> - (respawn? #f)))))
> + (one-shot? #t)))))
>
> (define (host-name-service name)
> "Return a service that sets the host name to @var{name}."
> --
> 2.24.0
>

> From 6c13de1914503afb3533a0fe032b4db767011874 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <efraim@flashner.co.il>
> Date: Wed, 20 Nov 2019 21:38:18 +0200
> Subject: [PATCH 2/3] services: console-keymap-service-type: Make service
> one-shot.
>
> * gnu/services/base.scm (console-keymap-service-type): Remove 'respawn?'
> keyword from shepherd-service-type, add 'one-shot?'.
> ---
> gnu/services/base.scm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index 7cd42bb30a..022bb501ba 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -746,7 +746,7 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
> (start #~(lambda _
> (zero? (system* #$(file-append kbd "/bin/loadkeys")
> #$@files))))
> - (respawn? #f)))))
> + (one-shot? #t)))))
>
> (define-deprecated (console-keymap-service #:rest files)
> #f
> --
> 2.24.0
>

> From 153d02caa1333788df435ca4ffbf915c50d9cb01 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <efraim@flashner.co.il>
> Date: Wed, 20 Nov 2019 21:40:50 +0200
> Subject: [PATCH 3/3] services: console-font-shepherd-services: Make service
> one-shot.
>
> * gnu/services/base.scm (console-font-shepherd-services): Remove 'stop'
> and 'respawn?' keywords from shepherd-service-type, add 'one-shot?'.
> ---
> gnu/services/base.scm | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index 022bb501ba..cef2d4cb2b 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -797,8 +797,7 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
> "-C" #$device #$font))
> ((0 71) #t)
> (else #f))))
> - (stop #~(const #t))
> - (respawn? #f)))))
> + (one-shot? #t)))))
> tty+font))
>
> (define console-font-service-type
> --
> 2.24.0
>




--
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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl3Vmd8ACgkQQarn3Mo9
g1Gw+g/+Okj7lvNo8Y6JZIB5h1QAaGkGy7BARklokYkeTKRZ+vsUjz7+OBBder4M
QrDO7aDhpP088on5/f897u7mfTxG+pkS+elKtfwd6S6PWcQEEufOCEde5gIiJgUJ
FWHjbpgv/TWvyT2gaCiFRQwPSWdqB5/WCwF4YGI0pAiFAkUPI5SFfXGSgwRxTXfX
p8DO/d3nKvRjX1C+DZQcxxdujRySav90v11+7bcw9QranRnzLnqKmJU4bASXx+l/
jfTt4alJ4F6JSpzQ8yjP35JqHpxQutMYVrYhyQpN8AOXlIdEIEp7Uio8ljA9wHd1
JFnWvKZ/ASz+GBA9P7H/qJ3baAksBGSzQXTB3fBqAeqWJgaL61DROXBYKKMj3++K
03aqZAkZ/H6DF+zLevCFjY+fo/v7Q9Ld0Y83rW5+Zz9RKtGfVq+d2yX/D44X25xa
AfbTK+cmuq8WxCxxzuA8XDvfb53tl5sgn0Ld0r33VC6j/dM3yWk47cyAzO0RT1C9
zc1rmpr+Lgl3SSezAlam0RDqnoKoQd3aHgwrxRvXRxzaiOazPZ1eunDiDKHMRVaE
DjVAtb0ym1VX6uWB5DuBd62F09PK4TCuioc2ps8bPevOJsAEKgIY0Up6Eq0dI6tB
glFThR9GJbYwUS1JjJzP9ls9ydw6X0BzuNNj6uCn3iY8AYEPOfQ=
=GvYp
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 8 Dec 2019 22:28
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 38304@debbugs.gnu.org)
87wob6mrqt.fsf@gnu.org
Hello!

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

Toggle quote (8 lines)
> On Wed, Nov 20, 2019 at 09:45:44PM +0200, Efraim Flashner wrote:
>> After changing the sysctl service to use one-shot I found 3 more that
>> look like they'd be good choices.
>>
>
> Actually, it looks like agetty and mingetty both rely on the host-name
> service, so that one doesn't look like a good choice after all.

Is it a problem, though? I think they should still get started, even if
‘host-name’ is one-shot, no?

Conceptually, ‘console-keymap’ and ‘console-font’ do not look like
one-shot to me though: it’s not implemented, but their ‘stop’ method
could very much restore the previous keymap/font.

WDYT?

Ludo’.
E
E
Efraim Flashner wrote on 13 Dec 2019 21:50
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 38304@debbugs.gnu.org)
20191213205011.GK8302@E5400
On Sun, Dec 08, 2019 at 10:28:42PM +0100, Ludovic Courtès wrote:
Toggle quote (15 lines)
> Hello!
>
> Efraim Flashner <efraim@flashner.co.il> skribis:
>
> > On Wed, Nov 20, 2019 at 09:45:44PM +0200, Efraim Flashner wrote:
> >> After changing the sysctl service to use one-shot I found 3 more that
> >> look like they'd be good choices.
> >>
> >
> > Actually, it looks like agetty and mingetty both rely on the host-name
> > service, so that one doesn't look like a good choice after all.
>
> Is it a problem, though? I think they should still get started, even if
> ‘host-name’ is one-shot, no?

I'll try to test this in the next week or so.

Toggle quote (6 lines)
>
> Conceptually, ‘console-keymap’ and ‘console-font’ do not look like
> one-shot to me though: it’s not implemented, but their ‘stop’ method
> could very much restore the previous keymap/font.
>

I feel like since these commands don't have an 'undo' command from the
terminal or from various DEs (that I know of) that making them one-shot
would make more sense.

Also we wouldn't want the keymap or font to change during shutdown when
services get stopped.

--
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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl3z+X8ACgkQQarn3Mo9
g1HsfxAAih5PAjWTac8q8mMBJEZecaQWiMgneN/3MkizIwQXfA3odMqdYLceIim6
yn3tJCDrjmGgibjiF3DaxF8gHkaIsmCgwQngBEZnoZUz7lLeuUvXWckZjEIhySAY
9jLcBsyfC+c4AV26HKqSiLluNDARVZ7zcRYhNOs/Czdbb1KZN0o9YqzDdui+IUos
HyE0Ko8FQP2lOM8LqeoXMFaudCg2b+xK6AhAa94D22wYx44jiDH3T+KzRbYW3Rs4
UBedNOiyqBYu2B8mpP9wqpoFs5Moq7b5fGzzFi0eYsoxQC05HQlEo4/WEKVL7ahy
etVN7VfouaX09q5L0fBAaIJCO+KyxH/qhYRb3c38uxY2H1Uqn2wzItdoIrdmaNps
CCvsfQ5cA7D7Z6m+BKD7UMPT87+zW2oMo5F6G/flIKoXD4zV/Kio6XfM3RN1XAPh
T+r7FSZZJEeoav5cZpcgEp98eZGnwF9ZZx7rFJpawubFE1ESlfIW6NjRPo7M9gUm
sx/tp6g0ICjK9ytrjBaJXBRrAKx2OMZ1oQCkPLe+yd2B7pKwKGXLrTucuA9qhG4m
Mx0tWy9RupyC+VzJndA/sp5y5fBb7Ip38zVyNVwnIRoImkkBiiaukTwQ4Vypad5p
PktAPWS4mGr9/bb2hjo69BG0HPTR59+8w6g4oYg9GB5tHZVDs88=
=105+
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 29 Dec 2019 09:06
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 38304@debbugs.gnu.org)
20191229080612.GB23018@E5400
On Fri, Dec 13, 2019 at 10:50:11PM +0200, Efraim Flashner wrote:
Toggle quote (18 lines)
> On Sun, Dec 08, 2019 at 10:28:42PM +0100, Ludovic Courtès wrote:
> > Hello!
> >
> > Efraim Flashner <efraim@flashner.co.il> skribis:
> >
> > > On Wed, Nov 20, 2019 at 09:45:44PM +0200, Efraim Flashner wrote:
> > >> After changing the sysctl service to use one-shot I found 3 more that
> > >> look like they'd be good choices.
> > >>
> > >
> > > Actually, it looks like agetty and mingetty both rely on the host-name
> > > service, so that one doesn't look like a good choice after all.
> >
> > Is it a problem, though? I think they should still get started, even if
> > ‘host-name’ is one-shot, no?
>
> I'll try to test this in the next week or so.

I tested this a bit with some other services I'm working on. When
service A is one-shot and service B depends on it, when service B starts
it also 'runs' service A. So it looks like it won't be a problem
after all.

Toggle quote (21 lines)
>
> >
> > Conceptually, ‘console-keymap’ and ‘console-font’ do not look like
> > one-shot to me though: it’s not implemented, but their ‘stop’ method
> > could very much restore the previous keymap/font.
> >
>
> I feel like since these commands don't have an 'undo' command from the
> terminal or from various DEs (that I know of) that making them one-shot
> would make more sense.
>
> Also we wouldn't want the keymap or font to change during shutdown when
> services get stopped.
>
> --
> 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



--
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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl4IXnQACgkQQarn3Mo9
g1H4TBAAuwykxITR6tJ29cQXxAGrPtylsOrGpAonggHNV972IZUW9gSOYuhk2QTi
XXa+F1a1hBMgYAuGxZX9Ve7+eOdofmHz8HivtBShkCYCP7hezR6XsyNeNvmLzax5
uJLJ89RV9E3Oc+9sDxnjqZgNyyJUsP8xrTXus0vvQYErrWFiyVRuTHy5EpDDALZr
Rkw8RCdwFwIcv4RsHzookLHOEDW9ozyPb0uiAsTh5IkHmNwk/gTaOhEo9ULI5gME
+Ry2UNftUCiqdCoM2hab7+eyc7Jagv6RZxvvS3Br/jO8SZNTC7uAF+QCp75S07X5
RFH+i68xO9iu4IgUy7mkyA0xnxAG/ef7Mr0rPKXu7g9MXD0Ce7e8v6Ni9ElhpDAY
2JCk6IPkjCxflpuWUCFXT+T+uxAnPqqVVvDO82yWI3NJG06hJsJXC8QKp5FYAsFM
7Z8dRtDXYwG6SGaRRxGGll7GVY4IZZC6DzEjQXdyaE9aUhqxy9B1SZsObeSCuTTB
NSZhUCDIswvX+mudBzs0fXSn+9PgO2Unjb45OBM+0/G+PSOCTszq/AJZAQeC38x5
BI+QuQQUhsoTF1acrdS+7/kuuGgFtR6WLCuFr/4Rf0trcG7eJJgM8okollI+auny
OCJ0REb493GVYTHtLpYnJHtqnN+NZkXU1fmm2IyHRwcHk+X0oww=
=W7RR
-----END PGP SIGNATURE-----


?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 38304@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 38304
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch