mbornet-hl/hl

[Bug] Error with Config Files in /etc/default and instructions

Closed this issue · 9 comments

  1. To set up the configuration files included in the project globally the current documentation indicates to make the following copy:
cp config_files/hl /etc/default

But, the config_files/hl file does not exist, there are several hl_*.cfg files in that folder. So we assume that there is an error in the writing.

  1. On the other hand, if we copy the whole folder:
sudo cp -R config_files/ /etc/default/hl/
  • And then test a configuration:
df -h | hl --df
  • We get an error:
hl: cr_read_config_file() : "/etc/default/hl" is not a regular file !
  1. Finally, if we copy the whole folder and then export the variable, it works.
sudo cp -R config_files/ /etc/default/hl/
export HL_CONF=/etc/default/hl

I think that maybe the default location is badly encoded in the source.

And I have one more weird issue at this point:

  • If the folder /etc/default/hl exists
  • then I have this same error (hl: cr_read_config_file() : "/etc/default/hl" is not a regular file!) every time I open a new bash session in, even though I don't run hl to my knowledge.
  • For now I decided to not use the /etc/default location.

  • I use /etc/hl/ and $HOME/.config/hl/:

sudo cp -R config_files/ /etc/hl/
cp -R config_files/ $HOME/.config/hl/
  • Then I export HL_CONF=$HOME/.config/hl:/etc/hl in my bashrc.

But this solution is not global.

Hello,

in the first releases of the hl command, there were only two known configurations files :

  • /etc/default/hl (global to all users)
  • $HOME/.hl.cfg (specific to each user)

/etc/default/hl has never been intended to be a directory.
With the adding of a great number of configurations, and the need to install hl and its configurations files on a cluster, I added the environment variables HL_CONF and HL_CONF_GLOB, so that configurations files can be installed anywhere on a shared filesystem (NFS, SMB, Lustre, GPFS, ...) : that eliminates the need to install the configurations files on every machine that wants to use them. There is no longer the need to deploy configurations files on every machine, they just can be installed on a remote file server.
I personally no longer use /etc/default/hl, but is still usable if you want to. I shall modify the documentation to remove references to /etc/default/hl, which has become obsolete.
You can create the directory that you want to put your configurations files in.

Regards.

Thanks, I love hl.

Like you said, if you have the time you should spend some time on the docs, it will be more easy to pormote hl for every kind of users.

If you want a global solution, that is, if I correctly understand what you mean, a solution that allows every user to access all hl configurations files, you can configure the HL_CONF and HL_CONF_GLOB variables in a /etc/profile.d file. That way, every user will be able to access all the configurations files you have installed.

As you said : "if you have the time" ... ;-)
I wish I add more time to spend on every development project, every documentation, every article I write, ... :-(

By the way : do you only use the configurations I create, or do you create your own configurations ?
I have only few feedbacks of users of hl, I don't know how many users use it, I just see the stars on github, and the downloads on github statistics, but that's all.
It would be nice to have feedbacks ...

I write a lot of scripts where I highlight things almost manually or with awk. So hl is a blessing.

I have wrote 2 small configs for some systemd and motd tools, but it's a work in progress. I will give you an update when I share it in a repo.

About the setup, I integrated hl in the collection of tools and dotfiles that I always deploy where I work. I put your generic configs in /etc/hl/config.d/ and the custom ones for the user in ~/.config/hl/config.d/. This is in my .bashrc:

if [[ -f "/usr/local/bin/hl" ]]; then
  export HL_CONF=$HOME/.config/hl/config.d:/etc/hl/config.d
fi

Great !!!
Thanks for the feedback !
I long to see your work.
Feel free to ask if you need help to create your configurations.

I close this issue since it's not a bug with config files. It's rather a problem with documentation.