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

Conffiles with python sources to deb package #1823

Open
kiarn opened this issue Aug 26, 2021 · 2 comments · May be fixed by #2027
Open

Conffiles with python sources to deb package #1823

kiarn opened this issue Aug 26, 2021 · 2 comments · May be fixed by #2027

Comments

@kiarn
Copy link

kiarn commented Aug 26, 2021

Hello,

My question may sound stupid, but I'm not able to generate a deb package with config files in /etc/.
As consequences, each upgrade overwrite the files in /etc/.

For the context, I have a directory src containing a python module which I want to package, a directory debian for some stuff, and I use the following command :

fpm -s python \
    -t deb \
    --python-bin python3 \
    -p build/myapp_VERSION_ARCH.deb \
    -x "*.pyc" \
    -x "*/__pycache__" \
    --no-auto-depends \
    -d build-essential \
    -d python3-pip \
    -d python3-dev \
    --deb-auto-config-files \
    --config-files ./etc/myapp/config \
    --deb-changelog CHANGELOG.txt \
    --after-install debian/scripts/postinstall.sh \
    --deb-systemd debian/systemd/myapp.service \
    --deb-systemd-enable \
    --deb-systemd-auto-start \
    src

With this command, the package is generated, I can install it without error, service in systemd is well configured, the file /etc/myapp/config is present but it will be overwritten with a next version.
I tried the option --deb-config or to put the directory /etc/ in another place, but without success.

The resulted deb package does not contain any conffiles.
Am I missing something obvious ?

@benj200
Copy link

benj200 commented Jul 14, 2023

I have the same issue

@me21
Copy link

me21 commented Oct 6, 2023

Try creating conffiles by hand and adding --deb-meta-file conffiles to the command. Yes, it's a workaround.

Or try patching: add add_path(path, allconfigs) to

fpm/lib/fpm/package/deb.rb

Lines 1067 to 1071 in b085edc

if !File.exist?("#{dcl}")
logger.debug("Adding config file #{path} to Staging area #{staging_path}")
FileUtils.mkdir_p(File.dirname(dcl))
FileUtils.cp_r path, dcl
else
as the last line in this block. If I understand correctly, the first add_path call in
add_path(path, allconfigs)
fails because the file has not been copied to the staging directory yet. We retry the call after copying.

me21 added a commit to me21/fpm that referenced this issue Oct 6, 2023
@me21 me21 linked a pull request Oct 7, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants