Change name and add user files for rpm custom package

Last post 03-31-2020, 4:53 PM by hasafi. 3 replies.
Sort Posts: Previous Next
  • Change name and add user files for rpm custom package
    Posted: 03-12-2020, 7:29 AM

    Hello,

     here is my steps how to change name of rpm custome packer be default it is custom-linux.Instance001. You can change it as Commvault.Instance001 but still it is not standard for Linux world.

    Steps:

    Prepare two session on machine where you will build classic rpm package.
    2nd session go to path where you will have stagging folder and run this command:

    while true; do find . -name \*.spec -exec cp {} . \;;done

    1st session run normal wizard for create custom rpm package use stagginf folder where you are standing in 2nd session. After successul create package on this sesssion you should find spec file in current folder of second session. Just press CTRL-C for quit from loop.

    Now we have spec file and rpm package. Rename spec file to Commvault_linux-x8664.spec

    Exact package like this:

    mkdir ~/extracted_rpm;cd ~/extracted_rpm
    rpm2cpio /full_path_to/commvault.rpm |cpio -idmv

    prepare environment for rpmbuilder:

    mkdir ~/rpmbuild
    cd ~/rpmbuild
    mkdir BUILD  RPMS  SOURCES  SPECS  SRPMS

    copy /path_to/file.spec SPECS

     

    create file ~/.rpmmacros with this content:

    %_topdir /full_path_to/rpmbuild
    %__prelink_undo_cmd /bin/cat cat library

    %_smp_mflags  -j3
    %__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot

    Now you can add more files to file structure in ~/extracted_rpm/opt/commvault

    and you can modify spec file.

    Rename 
    Name: Commvault.Instance001
    to
    Name: Commvault

    or add/change anything else there.

    You have to modified section %prep to this:

    mkdir -p %{buildroot}/
    cp -pR ~/extracted_rpm/* %{buildroot}/

    Now rpm structure and modification are ready to create new your rpm custome package. Run these commands to create package:

    cd ~/rpmbuild
    rpmbuild --buildroot=$PWD/BUILD -ba SPECS/Commvault_linux-x8664.spec 

    OR

    rpmbuild --buildroot=$PWD/BUILD -ba SPECS/Commvault_linux-x8664.spec --define 'dist .el6'
    rpmbuild --buildroot=$PWD/BUILD -ba SPECS/Commvault_linux-x8664.spec --define 'dist .el7'

    This will create rpm package under folder RPMS. You can check result by command:

    rpm -qip RPMS/*.rpm

    Tested on Linux RH6/7 and AIX7.1

    Any feedback is welcome. In next post I will pusblish how sign it by GPG for confirmation that it is really your package.

    Thank you
    Filip Hasa

     
  • Re: Change name and add user files for rpm custom package
    Posted: 03-19-2020, 7:57 AM

    Hi Filip

    Thank you very much for sharing a very detail and informative post

    Regards

    Winston

  • Re: Change name and add user files for rpm custom package
    Posted: 03-31-2020, 4:51 PM

    deleted

  • Re: Change name and add user files for rpm custom package
    Posted: 03-31-2020, 4:53 PM

    Dont forget to add rulez for iptables: something like this:

    %post
    iptables -A INPUT -p tcp --dport 8400 -j ACCEPT -m comment --comment "Commvault"
    iptables -A INPUT -p tcp --dport 8402 -j ACCEPT -m comment --comment "Commvault"
    iptables -A INPUT -p tcp --dport 8403 -j ACCEPT -m comment --comment "Commvault"
    iptables -A INPUT -p tcp --dport 8408 -j ACCEPT -m comment --comment "Commvault"
    %postun
    iptables -D INPUT -p tcp --dport 8400 -j ACCEPT -m comment --comment "Commvault"
    iptables -D INPUT -p tcp --dport 8402 -j ACCEPT -m comment --comment "Commvault"
    iptables -D INPUT -p tcp --dport 8403 -j ACCEPT -m comment --comment "Commvault"
    iptables -D INPUT -p tcp --dport 8408 -j ACCEPT -m comment --comment "Commvault"
     

    Cool(y)

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2020 Commvault | All Rights Reserved. | Legal | Privacy Policy