I am trying to rebuild nano rpm package on CentOS 8 so after installing it I will be able to run nano using command newnano.
After some googling I came to the conclusion that I need to change .spec file and build package using command rpmbuild -ba nano.spec
.
Here is what I’ve already tried:
- Changing name in the beginning of .spec file, so it looked like that:
Summary: A small text editor
Name: newnano
...
But when I tried to build package there was error:Bad exit status from '/var/tmp/rpm-tmp.DSP7dc (%prep)
As I understand after unzip tar archive its tried tocd newnano-2.9.8
but there is no such directory. - Adding alias in %install section:
%install
cd build
%make install
rm -f %{buildroot}%{_infodir}/dir
alias newnano="nano"
...
Building and installation was successful but alias was not created. - Using %package. I insert after
%description
and before%prep
in original .spec this:
%package -n newnano
Summary: test
%description -n newnano
test
Also I add-n newnano
to%files
section. Building and installation was successful but new command was not added.
So how I have to change .spec file to achieve my goal?
2
Answers
You’ll have to do a few things:
nano
and remove thernano
symlink)Instead of messing with
src/Makefile.am
, you can probably rename things in the%install
stanza of the specfile, but I don’t know enough aboutnano
to tell you if it will be still identifying itself properly, etc.Have fun!
There is a very simpe way to do it via
rpmrebuild
and.rpm
nano
package.rpmrebuild -enp nano.rpm
.spec
file (it will open after previous comand) you should do these:Name: nano
withName: newnano
(optional, but recommended)mv /usr/bin/nano /usr/bin/newnano
before the firstexit 0
line. This section you can find before%changelog
.rpm
that you will see after you closevim
.rpm
viarpm -i
command