Do budowy pakietu będzie potrzebny pakiet rpm-build.

Dla systemu Fedora i CentOS 8

sudo dnf install gcc rpm-build rpm-devel rpmlint make python bash coreutils \
diffutils patch rpmdevtools

Dla systemu CentOS 7

sudo yum install gcc rpm-build rpm-devel rpmlint make python bash coreutils \
diffutils patch rpmdevtools

Przygotowanie środowiska do budowy pakietów

mkdir -p rpmbuild/SPECS

Najważniejszą częścią jest plik spec

touch SPECS/utils.spec

Przykładowy plik spec

Name:       hello-world
Version:    1
Release:    1
Summary:    Most simple RPM package
License:    FIXME

%description
This is my first RPM package, which does nothing.

%prep
# we have no source, so nothing here

%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash
echo Hello world
EOF

%install
mkdir -p %{buildroot}/usr/bin/
install -m 755 hello-world.sh %{buildroot}/usr/bin/hello-world.sh

%files
/usr/bin/hello-world.sh

%changelog
# let's skip this for now

Skrypt do budowy

#!/usr/bin/env bash

sed -i -e "s/Version:.*/Version: 1.9_$(date +%s)/g" SPECS/utils.spec

cd SPECS
rpmbuild --target x86_64 -bb utils.spec

wstecz

Date: 2021-03-14T22:25:04+01:00