From: Christopher Baines <mail@cbaines.net>
To: Oleg Pykhalov <go.wigust@gmail.com>
Cc: 27855@debbugs.gnu.org
Subject: [bug#27855] [PATCH] gnu: Add rsync service.
Date: Thu, 3 Aug 2017 16:33:22 +0100 [thread overview]
Message-ID: <20170803163322.3e87b004@cbaines.net> (raw)
In-Reply-To: <87r2wszni8.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5509 bytes --]
On Thu, 03 Aug 2017 18:20:31 +0300
Oleg Pykhalov <go.wigust@gmail.com> wrote:
> Hello Christopher,
>
> Christopher Baines <mail@cbaines.net> writes:
>
> > On Sat, 29 Jul 2017 14:03:49 +0300
> > Oleg Pykhalov <go.wigust@gmail.com> wrote:
> >
> >> >> +@deffn {Scheme Variable} rsync-service-type
> >> >> +This is the type for the @uref{https://rsync.samba.org} rsync
> >> >> daemon, +@command{rsync-configuration} record as in this
> >> >> example: +
> >> >> +@example
> >> >> +(service rsync-service-type
> >> >> + (rsync-configuration))
> >> >> +@end example
> >> >> +
> >> >> +See below for details about @code{rsync-configuration}.
> >> >> +@end deffn
> >> >> +
> >> >> +@deftp {Data Type} rsync-configuration
> >> >> +Data type representing the configuration for
> >> >> @code{rsync-service}. +
> >> >> +@table @asis
> >> >> +@item @code{package} (default: @var{rsync})
> >> >> +Package object of the Rsync utility for efficiently
> >> >> transferring and +synchronizing files.
> >> >
> >> > Object doesn't really fit here, if anything its a record. Also, I
> >> > don't think this needs a description of what rsync does, it's
> >> > probably clearest to just say that this is the rsync package?
> >>
> >> OK, is it good?
> >>
> >> @code{rsync} package to use.
> >
> > Yep, in my opinion, that is the right amount of information.
> >
> >> >> +(define (rsync-config-file config)
> >> >> + "Return the rsync configuration file corresponding to
> >> >> CONFIG."
> >> >> + (computed-file
> >> >> + "rsync.conf"
> >> >> + #~(begin
> >> >> + (call-with-output-file #$output
> >> >> + (lambda (port)
> >> >> + (display "# Generated by 'rsync-service'.\n" port)
> >> >> + (format port "pid file = ~a\n"
> >> >> + #$(rsync-configuration-pid-file config))
> >> >> + (format port "lock file = ~a\n"
> >> >> + #$(rsync-configuration-lock-file config))
> >> >> + (format port "log file = ~a\n"
> >> >> + #$(rsync-configuration-log-file config))
> >> >> + (format port "port = ~a\n"
> >> >> + #$(number->string
> >> >> + (rsync-configuration-port-number
> >> >> config)))
> >> >> + (format port "use chroot = ~a\n"
> >> >> + #$(if (rsync-configuration-use-chroot?
> >> >> config)
> >> >> + "true" "false"))
> >> >> + (display "[files]\n" port)
> >> >> + (format port "path = ~a\n"
> >> >> + #$(rsync-configuration-share-path config))
> >> >> + (format port "comment = ~a\n"
> >> >> + #$(rsync-configuration-share-comment
> >> >> config))
> >> >> + (format port "read only = ~a\n"
> >> >> + #$(if (rsync-configuration-read-only?
> >> >> config)
> >> >> + "true" "false"))
> >> >> + (format port "timeout = ~a\n"
> >> >> + #$(number->string
> >> >> + (rsync-configuration-timeout config)))
> >> >> + #t)))))
> >> >
> >> > It might be neater here to use mixed-text-file here. It might
> >> > look something like...
> >> >
> >> > (define (rsync-config-file config)
> >> > "Return the rsync configuration file corresponding to CONFIG."
> >> > (match config
> >> > (($ <rsync-configuration> package port-number pid-file
> >> > lock-file log-file use-chroot? share-path
> >> > share-comment read-only? timeout)
> >> > (mixed text-file "rsync.conf"
> >> > "# Generated by 'rsync-service'.\n"
> >> > "pid file = " pid-file "\n"
> >> > "lock file = " lock-file "\n"
> >> > "log file = " log-file "\n"
> >> > "port = " (number->string port-number) "\n"
> >> > "use chroot = " (if use-chroot? "true" "false") "\n"
> >> > "[files]\n"
> >> > "path = " share-path "\n"
> >> > "comment = " share-comment "\n"
> >> > "read only = " (if read-only? "true" "false") "\n"
> >> > "timeout = " (number->string timeout) "\n"))))
>
> OK, patched.
>
> >> > One thing I tried with the Tailon service, was to define a
> >> > gexp-compiler for the record type representing the configuration
> >> > file. One really big advantage in the case of Tailon is that it
> >> > easily allows the use of a custom file, just by providing a
> >> > different gexp.
> >>
> >> So, this way you could provide your existing Tailon config as a
> >> file in system declaration? Nice.
> >
> > Yep, I think something like the following should just work, but I
> > haven't tested it yet.
> >
> > (service tailon-service-type
> > (tailon-configuration
> > (config-file (local-file "../tailon.yml"))))
> >
> > I bring this up, as I think it is great if this is a feature of all
> > services, I'm having trouble though working out how you might do
> > that in this case, with the use of values in the activation service
> > extension. I can see complicated approaches, but nothing simple and
> > clear enough.
>
> I tried to apply your work in tailon service, but I have troubles as
> you described. So I just cleaned up code little bit.
Those changes are looking good :) Could you send the overall patch, as
that makes it easier at least for me to review and test?
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
next prev parent reply other threads:[~2017-08-03 15:34 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 22:01 [bug#27855] [PATCH] gnu: Add rsync service Oleg Pykhalov
2017-07-27 22:22 ` [bug#27855] ERROR: rsync rsync://localhost/files Oleg Pykhalov
2017-07-28 6:45 ` [bug#27855] [PATCH] services: rsync: Fix invalid gid nobody Oleg Pykhalov
2017-07-28 22:17 ` [bug#27855] [PATCH] gnu: Add rsync service Christopher Baines
2017-07-29 11:03 ` Oleg Pykhalov
2017-07-29 11:55 ` Christopher Baines
2017-08-03 15:20 ` Oleg Pykhalov
2017-08-03 15:29 ` Oleg Pykhalov
2017-08-03 15:33 ` Christopher Baines [this message]
2017-08-03 16:20 ` Oleg Pykhalov
2017-08-03 16:34 ` Oleg Pykhalov
2017-08-10 7:18 ` Christopher Baines
2017-08-10 18:21 ` Christopher Baines
2017-08-10 18:56 ` Oleg Pykhalov
2017-08-11 19:28 ` Oleg Pykhalov
2017-08-12 6:59 ` Christopher Baines
2017-08-12 13:13 ` Oleg Pykhalov
2017-08-12 17:46 ` Christopher Baines
2017-08-12 20:19 ` Oleg Pykhalov
2017-08-12 21:19 ` Christopher Baines
2017-08-19 20:34 ` Oleg Pykhalov
2017-08-19 22:19 ` Christopher Baines
2017-08-24 22:40 ` Oleg Pykhalov
2017-08-30 23:59 ` Christopher Baines
2017-08-31 13:04 ` Ludovic Courtès
2017-09-16 22:44 ` Oleg Pykhalov
2017-09-16 22:49 ` Oleg Pykhalov
2017-09-17 8:40 ` [bug#27855] Status: " Oleg Pykhalov
2017-09-18 6:20 ` [bug#27855] " Christopher Baines
2017-09-23 1:47 ` Oleg Pykhalov
2017-09-23 2:38 ` Oleg Pykhalov
2017-09-23 20:12 ` bug#27855: " Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170803163322.3e87b004@cbaines.net \
--to=mail@cbaines.net \
--cc=27855@debbugs.gnu.org \
--cc=go.wigust@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.