1
0
Fork
You've already forked hello
0
No description
  • Shell 100%
2026年03月09日 13:30:57 +01:00
scripts update scripts with verbose flags, add %license to spec 2026年03月09日 10:08:57 +01:00
src first commit 2026年03月09日 10:01:14 +01:00
.gitignore first commit 2026年03月09日 10:01:14 +01:00
fedora.md add fedora instructions 2026年03月09日 13:30:57 +01:00
hello.spec add fedora instructions 2026年03月09日 13:30:57 +01:00
LICENSE.md first commit 2026年03月09日 10:01:14 +01:00
README.md add fedora instructions 2026年03月09日 13:30:57 +01:00

RPM practice

See fedora instructions for fedora-specific procedure

0. Prep

run rpmdev-setuptree

1. Make the program

$ cat << EOF >> hello.sh
#!/bin/sh
echo "Hello world"
EOF

2. Place the script in the designated directory and make a tarball

$ mkdir hello-0.0.1
$ mv hello.sh hello-0.0.1
$ tar cf hello-0.0.1{.tar.gz,}

3. Put the tarball of source code in the rpmbuild sources folder (SOURCSE)

$ mv hello-0.0.1.tar.gz ~/rpmbuild/SOURCES

4. Make a spec file for the project and put it in SPECS

$ rpmdev-newspec hello
$ mv hello.spec ~/rpmbuild/SPECS

5. Fine-tune the spec file and add the deps

Since this is a shell script, with no build step, it's a noarch spec. Since it only depends on bash, add that to the dependencies. Fields can be removed (e.g. BuildRequires), as well as macros (%configure, %license, etc.), but each field that is there needs a corresponding value.

Notes on macros:

  • %{name} name of the package (as defined in the Name: field)
  • %{version} version of the package (as defined in the Version: field)
  • %{_datadir} shared data (/usr/sbin by default)
  • %{_sysconfdir} configuration directory (/etc by default)
  • You can verify any macro values with rpm --eval '%{_bindir}'

6. Check the spec for any errors

rpmlint ~/rpmbuild/SPECS/hello.spec

7. Build the package

$ rpmbuild -ba ~/rpmbuild/SPECS/hello.spec

8. Install it

$ sudo dnf install ~/rpmbuild/RPMS/noarch/hello-0.0.1-1.el8.noarch.rpm

Or with rpm the old-school way $ sudo rpm -ivh ~/rpmbuild/RPMS/noarch/hello-0.0.1-1.el8.noarch.rpm

9. Verify it's installed

$ rpm -qi hello