View Single Post
olf's Avatar
Posts: 305 | Thanked: 1,246 times | Joined on Aug 2015
#16
Originally Posted by mosen View Post
For deploying (and deleting when uninstalling) these files per RPM, you may use mount-sdcard's spec file as a template.
It also provides an example of a simple "one-shot" systemd system unit being deployed. Note that you have to deploy a user unit at the slightly different path /etc/systemd/user/ (= %{_sysconfdir}/systemd/user/, but do not use the OS' path /usr/lib/systemd/user/ as shown in section 1).
You also have to let RPM create the [Install] section links (result shown by @wolke in section 2) by a systemctl --user enable <unit> in a %post section and delete them per systemctl --user disable <unit> in a %preun section. Do not create them manually (either literally or in an RPM).

@mosen, you may even clone ("fork" in Github / Gitlab parlance) the mount-sdcard git repository as a starting point, as the git directory structure seems to fit well.

RPMs can be easily built on the device per:

* Preparation (once)
  • Creating necessary directories as nemo:
    Code:
    cd
    mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS}
  • Install rpmbuild (as root):
    Code:
    pkcon install rpm-build
* Building RPMs
  • Always as a simple user, never as root!
  • Download source tarball:
    Code:
    cd ~/rpmbuild/SOURCES/
    curl -LO <https://github.com/mosen/%{name}/archive/%{version}/%{name}-%{version}.tar.gz>
  • Extract and copy spec file:
    Code:
    cd ~/rpmbuild/
    tar -xvzf SOURCES/<%{name}-%{version}>.tar.gz
    cp <%{name}-%{version}>/rpm/*.spec SPECS/
  • Finally build the RPM per
    Code:
    rpmbuild -ba SPECS/<%{name}-%{version}>.spec

The only RPM documentation which comes somewhat close to a reference is still (though old and unmaintained): http://ftp.rpm.org/max-rpm/index.html
Plus many, many guides for noobs, absolute beginners, fresh starters, DAUs etc. exist (but none for advanced packagers) with lots of examples but no real explanations. The least worse of those are probably https://rpm-guide.readthedocs.io/en/latest/ and https://docs.fedoraproject.org/en-US...ide/index.html

P.S.: Better substitute every occurrence of /home/nemo/ in section 3 with ~/ to make it work for every user (as Jolla slowly prepares SailfishOS for multiple users).

HTH

Last edited by olf; 2020-01-22 at 19:52.
 

The Following 10 Users Say Thank You to olf For This Useful Post: