0

I have found a similar question on https://askubuntu.com/questions/144547/how-to-package-a-single-text-file-into-a-deb - unfortunately there is no answer I can use.

Basically, I want to manage a text file, say myapp.txt.config, in git; and then, I'd want to create a .deb package that copies it on Raspberry Pi in /usr/share/myapp/myapp.txt.config. However, most of the work I do in this repository is in MSYS2/MINGW64 on Windows 10, so I would like to avoid the round-trip to a Raspberry Pi, just to build the .deb package. Since this is just a text file, I'd like a single .deb to be valid for all distributions (stretch, bookworm for Raspbian).

How would I go about implementing this? I can see that a .deb file is an ar archive with tar archives inside - and there is working ar, tar, install, bash, python3, perl, make on MSYS2/MINGW64, however there are no Debian tools in the MSYS2/MINGW64 repos, as MSYS2 uses pacman instead.

I have seen in https://askubuntu.com/questions/90764/how-do-i-create-a-deb-package-for-a-single-python-script that the basic source package layout would be:

myapp-config/ -- myapp.txt.config -- debian/ -- changelog -- copyright -- compat -- rules -- control -- install 

... but I'd have to run dch --create to "create a properly formatted debian/changelog entry", and debuild --no-tgz-check to build; though dch is a Perl script (devscripts/scripts/debchange.pl), and so is debuild (devscripts/scripts/debuild.pl); but I cannot tell to what extent they will work on MSYS2/MINGW64.

I thought also of creating a Makefile with a single install entry:

install: install -D -m 644 myapp.txt.config /usr/share/myapp/ 

... and then calling checkinstall on it to create a deb package; checkinstall seems to be bash, but I cannot tell if it will run on MSYS2/MINGW64, as it probably needs sudo - also that github version is from 13 years ago, and it might even be that checkinstall is no longer being maintained.

So, what would be the right approach to build a .deb package in my case? If there is no way to build a .deb package on MSYS2/MINGW64, what would be the right way to organize the project, so I build this single-text-file .deb on Raspberry Pi with least amount of effort?

4
  • 1
    Arch Linux uses pacman, yet dpkg is available for installation (as are other package management tools) - presumably so that you can play around with other packaging formats for other systems you use. Are you sure dpkg isn't packaged in msys2? Commented Aug 9, 2024 at 13:27
  • 2
    I believe the deb format has been fairly stable over the last 13 years, so if that checkinstall thing worked 13 years ago it probably still works. But it's probably better to use standard tools if @muru is right. Commented Aug 9, 2024 at 14:09
  • Thanks @muru - I just did pacman -Ss dpkg, and only hit I got back was msys/pactoys, which only has updpkgver tool that contains dpkg in the name; so I guess MSYS2 maintainers did not copy this from Arch Commented Aug 9, 2024 at 14:23
  • 1
    Ah, disappointing. But you might still be able to use the Arch PKGBUILD to build it for your system - dpkg isn't very complex. Commented Aug 9, 2024 at 14:25

1 Answer 1

0

Found via

... that the simplest way to package a single text file in a .deb file is to use dpkg -b; in general, to install a /usr/share/myapp/myapp.txt.config file:

mkdir myapp-txt-config cd myapp-txt-config mkdir -p usr/share/myapp cp -av /path/to/myapp.txt.config usr/share/myapp/ mkdir DEBIAN nano DEBIAN/control # here, add/edit package information # finally, build cd .. fakeroot dpkg -b myapp-txt-config 

The file DEBIAN/control can look like below - note Installed-Size is size of the file in KB:

Package: myapp-txt-config Version: 0.01 Architecture: all Maintainer: your name<your mail id> Installed-Size: 2 Section: extras Priority: optional Homepage: your homepage Description: describe 

Note: this will only work on Linux, as there is no dpkg in MSYS2/MINGW64

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.