* writable skeleton files in sub-directories
@ 2020-10-14 19:04 Reza Alizadeh Majd
0 siblings, 0 replies; only message in thread
From: Reza Alizadeh Majd @ 2020-10-14 19:04 UTC (permalink / raw)
To: help-guix
Hi Guix,
working on a new service for `lxqt-desktop`, I need to provide a series
of predefined configurations for that. so I defined a series of
skeleton files and add them to the service using `account-service-type`
extension.
the problem is that when the location of a skeleton file is a path other
than user's home directory, it will be created in read-only mode.
I also tried to use `computed-file` and `chmod` the created file. but
the permission still didn't apply.
I also provided a test configuration to reproduce this issue:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu) (guix records))
;;
;; Test service definition
;;
(define-record-type* <test-config> test-config
make-test-config test-config?)
(define (test-skeletons)
`((".config/test"
,(computed-file "test-config-dir"
(with-imported-modules
'((guix build utils))
#~(begin
(use-modules (guix build utils))
(mkdir-p #$output)))))
(".config/test/foo.conf" ,(plain-file "foo.conf" "this is readonly"))
(".config/test/bar.conf"
,(computed-file "bar.conf"
(with-imported-modules
'((guix build utils))
#~(begin
(use-modules (guix build utils))
(call-with-output-file #$output
(lambda (port)
(display "this is also readonly" port)))
(chmod #$output #o644)))))
("baz.txt" ,(plain-file "baz.txt" "this is writable"))))
(define test-service-type
(service-type
(name 'test-service)
(extensions
(list (service-extension account-service-type
(const (test-skeletons)))))
(default-value (test-config))
(description "test service for skeleton files issue")))
;;
;; Operating system definition
;;
(operating-system
(host-name "guix.local")
(timezone "Asia/Tehran")
(locale "en_US.utf8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
(target "/dev/sda")))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
(type "ext4"))
%base-file-systems))
(services (cons* (service test-service-type)
%base-services)))
--8<---------------cut here---------------end--------------->8---
running the above configuration, `~/baz.txt` is writable, but
`foo.conf` and `bar.conf` files which are located in `~/.config/test/`
are both read-only:
--8<---------------cut here---------------start------------->8---
root@guix ~# ll
...
-rw-r--r-- 1 root root 29 Oct 14 21:18 baz.txt
...
root@guix ~# ll .config/test/
...
-r--r--r-- 1 root root 20 Oct 14 21:18 foo.conf
-r--r--r-- 1 root root 40 Oct 14 21:18 bar.conf
...
--8<---------------cut here---------------end--------------->8---
is there anything that I might be missed in definition of skeleton
files? or it might be a bug in creation of skeleton files.
Regards,
Reza
--
Reza Alizadeh Majd
PantherX Team
https://www.pantherx.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-14 19:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 19:04 writable skeleton files in sub-directories Reza Alizadeh Majd
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).