Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config woes #152

Open
marcbrevoort-cyberhive opened this issue Jun 24, 2022 · 2 comments
Open

Config woes #152

marcbrevoort-cyberhive opened this issue Jun 24, 2022 · 2 comments

Comments

@marcbrevoort-cyberhive
Copy link

marcbrevoort-cyberhive commented Jun 24, 2022

There appears to be something fundamental I'm missing on how the combi of fpm and pleaserun deals with (environment) configurations.

I have a sample config file in my .deb package which unpacks to /etc/default/packagename.example.

For this application, this can/should be manually edited and saved to /etc/default/packagename after which the service can be started and the config file is picked up.

However, when I (re)install the .deb package, /etc/default/packagename gets truncated to 0 bytes and the configuration is lost.
Moreover, this truncating appears to happen BEFORE the --before-install script is run, thwarting my cunning plan to back it up before install and writing it back afterwards.

So I tried storing the confiuration in /etc/init.d/ instead, which doesn't get overwritten, but it also doesn't get picked up.
What's the magic incantation that makes configurations be used and not overwritten each (re)install?

I have tried

  • Specifying and not specifying --config-files
  • enabling/disabling --deb-no-default-config-files flag
  • specifying the whole dir /etc as config files (which would recursively set all files in there configuration)
  • not having a --before-remove cleanup script

But the /etc/default/packagename file keeps getting overwritten. What else could be causing this behaviour?

Update: The "pleaserun" dir contains various 0-length files called /etc/default/packagename

-rw-rw-r-- 0/0               0 2022-06-24 09:59 ./usr/share/pleaserun/packagename/systemd/default/files/etc/default/packagename

Which turned out to be the culprit.
Ideally these would not be generated at all, but for now I'm removing any files ending in /etc/default/packagename from the pleaserun directory and that stops pleaserun from killing my configurations.

@jordansissel
Copy link
Owner

jordansissel commented Oct 11, 2022 via email

@marcbrevoort-cyberhive
Copy link
Author

marcbrevoort-cyberhive commented Oct 13, 2023

the fpm command line creating these empty package files is

fpm -v $VERSIONREVISION -n ${PKGNAME} -s pleaserun -t dir "/usr/bin/${PKGNAME}"

and the above creates blank /etc/default/[packagename] files (unless fixed in the meantime).

The workaround I've had in place for some time is

find ${MYDIR}/${PKGNAME}.dir|grep /etc/default/${PKGNAME}$|xargs rm

As the /etc/default/[packagename] file is no longer present, it is no longer overwriting the existing one, which allows the settings of a previous version to be kept between installs. However it would be nicer if somehow these empty files simply weren't being generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants