Open chrisSCM opened 6 years ago
Gitit needs to refer to the system default.conf in order to get defaults for fields not provided by the one you use with -f.
Seems like your gitit wasn't properly installed. The data files should be installed outside of the build directory. Did you use 'stack install'? There's an open issue on stack regarding this: https://github.com/commercialhaskell/stack/issues/848 Quoting from my comment from 2017:
I don't understand why this hasn't been fixed by now. It is a serious problem if stack can't be used to install data files to a location outside the stack work directory. Cabal has been able to do this from the beginning. Is there some serious conceptual problem with supporting it for stack?
See also #599.
Can you install using cabal install instead? That should properly install the data files.
What we should do is add a flag embed_data_files
,
as we have for pandoc and pandoc-citeproc. This would
allow the data files to be embedded in the executable,
avoiding this problem altogether.
This can be a problem even when you install with cabal. I used cabal install
and then copied the binary to the actual install location (as root). Months later I nuked my cabal store and now gitit won't start. Earlier versions of cabal had options like --datadir
similar to the Unix-style configure
scripts. This was, I believe, thrown out in order to make build results reproducible. (Which could have been achieved as well by factoring user inputs like the value of --datadir
into the binary hash, no idea why they didn't do that.) While cabal build
still has the --datadir
option, be prepared for surprises: with --datadir=/tmp/gitit/data
I get
datadir = "/tmp/gitit/data/x86_64-linux-ghc-8.6.5/gitit-0.15.1.2"
To summarize, there are two solutions:
cabal install gitit
, copy the data directory from the cabal store to somewhere else on the system and then run gitit with gitit_datadir=/whatever/path/ in the environment.cabal get
), run cabal build --datadir=/path/to/data
, look for a file named Paths_gitit.hs under dist-newstyle and in there for the definition of datadir, then manually copy binaries and data files to the appropriate locations found in the Paths_gitit.hs module.It would be nice if you could document this in the installation instructions.
A better solution, I think, would be to add an embed_data_files
flag like we have on pandoc; then the data files would be in the binary and we wouldn't need to worry about finding them.
When starting gitit with a non-privileged user, I find that despite using "-f" with a specific config file, gitit still refers to the default.conf. Of course, the non-privileged user doesn't have the right to access the build directory and its contents. The error is:
gitit: /root/gitit/.stack-work/install/x86_64-linux/lts-12.4/8.4.3/share/x86_64-linux-ghc-8.4.3/gitit-0.12.2.1/data/default.conf: openFile: permission denied (Permission denied)
The command was:sudo -u gitit /var/local/wiki/startup.sh
with startup.sh containing:/usr/local/bin/gitit -f wiki.conf
and being located in the wiki folder.