Reputation:
I have to develop a RPM package that merge some files, checking for existing files and directories, renaming files etc..
I developed a python script that do it, so executing python3 my_script.py it works perfectly.
Now I have to create a RPM package that should execute the python script.
I looked for rpmbuild, but when I install the RPM nothing appens, maybe I'm on the wrong way.
Any suggestions or web tutorials?
Thanks
Upvotes: 2
Views: 2902
Reputation:
I solved my problem thanks to some guides and tutorials I found on the net, this is a sample .spec that generates a .rpm which save installation files under /opt/mytest directory:
Name: mytest
Version: 1.0
Release: 1%{?dist}
Summary: A test script
Group: Utilities
License: GPL
URL: http://www.mypage.com
Source0: mytest-1.0.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description A test script inside a simple RPM package
%prep
%setup -q
%build
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/opt/mytest
install app.py $RPM_BUILD_ROOT/opt/mytest/app.py
%clean
rm -rf $RPM_BUILD_ROOT
%files
%dir /opt/mytest
%defattr(-,root,root,-)
/opt/mytest/app.py
/opt/mytest/app.pyc
/opt/mytest/app.pyo
%post
chmod 755 -R /opt/mytest
cd /opt/mytest
python3 app.py
Upvotes: 2