Copy to ~/.local/share from .spec

@nephros had made a good suggestion to move larger app data stores and I wanted to check if anyone does something like:

install -D -t %{buildroot}/%{_datadir}/%{name}/data/* \
    ~/.local/share/ \

Or ist there a better way to copy to user local directories when installing from an rpm?

You can’t reliably.

Some notes:

  • rpm runs as root when installing, so ~ or $HOME doesn’t do the right thing.
  • rpmbuild runs as the builduser (I think!) when doing %build, so you can’t install into ~ or $HOME homes really
  • you could assume /home/nemo or /home/defaultuser, but device owners may have other users configured
  • rpm might/should be able to run without the encrypted home being mounted

So TLDR is: you don’t mess with user’s homes in an RPM.

Still, my proposal was to package in an rpm file.

What you could do is package everything into PREFIX=/ (so /share/data/foo), and then have the installation done as user doing rpm -I --root=~/.local/ which should give $HOME/.local/share/data/foo.

But at that point I guess you could just use a tarball and not deal with rpm at all.

I’m hoping @martyone pipes in :slight_smile: But it’s clear that ~ is not usable. I meant something like:


and kin. But I understand this is completely ‘vendor’ dependent.

I am afraid @nephros is right.

It is common to distribute big (or just “unstable”) data files separately from the program. Consider e.g. map applications. Wouldn’t that approach be more suitable in your case?

You could do it as @nephros suggested with rpm --root=... but let your program do it instead of asking the user to do so manually. (The rationale for doing it this way would be the ability to use the same distribution channel, i.e., no need for separate hosting for the data.)

Well, it’s tricky. It’s a game. The game levels are necessary for the use of the application. I’m also, just the packager, although I’ve started doing some bug fixes.

Use of rpm from the app sounds like the way to go. Or libzypp? Rabbit hole. A good resource for programmatic use of rpm?

Is it even possible to distribute something like data rpms in harbour? At the moment that point is moot since the game is on chum and openrepos, but, it’d be nice to get it into harbour.

I would go the KISS way :slight_smile: system("rpm -I ...")

You can distribute program through Harbour and let it download data RPMs from chum/openrepos.

Ah, a man after my own heart (the apps I took over from tobias abuse the system to the max :slight_smile:


In the meantime, I’m looking at the culprit data, as well. Most of the weight is the sound files (tunes, not fx).