No description
|
|
||
|---|---|---|
| scripts | update scripts with verbose flags, add %license to spec | |
| src | first commit | |
| .gitignore | first commit | |
| fedora.md | add fedora instructions | |
| hello.spec | add fedora instructions | |
| LICENSE.md | first commit | |
| README.md | add fedora instructions | |
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