skip to Main Content

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:

  1. 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 to cd newnano-2.9.8 but there is no such directory.
  2. 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.
  3. 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


  1. You’ll have to do a few things:

    1. Get the current specfile (looks like you did that)
    2. Change the name of the RPM (looks good)
    3. Change the name of the GNU package (hint: look in configure.ac)
    4. Add another patch to the RPM that modifies the final executables (hint: look in src/Makefile.am – you want to rename nano and remove the rnano symlink)
    5. Rebuild

    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 about nano to tell you if it will be still identifying itself properly, etc.

    Have fun!

    Login or Signup to reply.
  2. There is a very simpe way to do it via rpmrebuild and .rpm nano package.

    1. rpmrebuild -enp nano.rpm
    2. In .spec file (it will open after previous comand) you should do these:
      • replace Name: nano with Name: newnano (optional, but recommended)
      • add mv /usr/bin/nano /usr/bin/newnano before the first exit 0 line. This section you can find before %changelog
    3. Look carefully and remember the path of rebuilded .rpm that you will see after you close vim
    4. Install rebuilded .rpm via rpm -i command
    5. (Optional: maybe you will need to reboot)
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search