• rpmbuild命令RPM包制作kafka示例SPEC


    kafka的自定义安装路径RPM包制作

    # 编写SPEC
    cat kafka.spec
    
    BuildArch:     noarch
    Name:          kafka_2.11
    Version:       2.1.0
    Release:       1
    License:       Apache License v2.0
    Group:         Development/Libraries
    Summary:       This is a Kafka RPM installation package
    
    URL:           www.ksyun.com
    
    Source0:       %{name}-%{version}.tar.gz
    Source1:       kafka.service
    BuildRoot:     %{_topdir}/BUILDROOT
    
    
    
    Requires:      /bin/sh
    Requires:      /usr/bin/env
    #Requires:      rpmlib(CompressedFileNames) <= 3.0.4-1
    #Requires:      rpmlib(FileDigests) <= 4.6.0-1
    #Requires:      rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires:      sh-utils
    #Requires:      rpmlib(PayloadIsXz) <= 5.2-1
    #suggest
    #enhance
    
    %description
    This is a Kafka RPM installation package
    
    %prep
    %setup -q
    #tar -zxf %{sources}
    
    %install
    #mkdir -p $RPM_BUILD_ROOT/usr/%{stack_name}/%{stack_version}/atlas
    #mkdir -p $RPM_BUILD_ROOT/usr/%{stack_name}/%{stack_version}/etc/atlas/conf.dist
    #
    #cp -rp %{_builddir}/%{name}-%{version}/* $RPM_BUILD_ROOT/usr/%{stack_name}/%{stack_version}/atlas
    #cp -rp %{_builddir}/%{name}-%{version}/conf/* $RPM_BUILD_ROOT/usr/%{stack_name}/%{stack_version}/etc/atlas/conf.dist
    
    mkdir -m 0755 -p $RPM_BUILD_ROOT/data/apps/kafka
    mkdir -m 0755 -p $RPM_BUILD_ROOT/usr/lib/systemd/system
    
    cp -rp %{_builddir}/kafka_2.11-2.1.0 $RPM_BUILD_ROOT/data/apps/kafka/kafka_2.11-2.1.0
    
    if [ ! -f "/usr/lib/systemd/system/kafka.service" ]; then
    %{__install} -p -D %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/systemd/system/kafka.service
    fi
    
    %post -p /bin/sh
    #if [ !  -e "/etc/atlas/conf" ]; then
    #    rm -f /etc/atlas/conf
    #    mkdir -p /etc/atlas/conf
    #    cp -rp /usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/* /etc/atlas/conf
    #fi
    #/usr/bin/hdp-select --rpm-mode set atlas-server 3.0.1.0-187
    #/usr/bin/hdp-select --rpm-mode set atlas-client 3.0.1.0-187
    
    #cp -rp %{Source1} $RPM_BUILD_ROOT/usr/lib/systemd/system/kafka.service
    
    %files
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/bin"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/models"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/models/0000-Area0"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/models/1000-Hadoop"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/models/1000-Hadoop/patches"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/models/2000-RDBMS"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/models/3000-Cloud"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/server"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/server/webapp"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/atlas/tools/migration-exporter"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/atlas-application.properties"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/atlas-env.sh"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/atlas-log4j.xml"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/atlas-simple-authz-policy.json"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/hbase"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/hbase/hbase-site.xml.template"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/currency.xml"
    #%dir %attr(0755, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/lang"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/lang/stopwords_en.txt"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/protwords.txt"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/schema.xml"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/solrconfig.xml"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/stopwords.txt"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/solr/synonyms.txt"
    #%attr(0644, root, root) "/usr/hdp/3.0.1.0-187/etc/atlas/conf.dist/users-credentials.properties"
    #
    #%defattr(-,root,root)
    /data/apps/kafka
    /usr/lib/systemd/system/kafka.service
    %defattr(-,root,root)
    
    #######################
    #### FILES SECTION ####
    #######################
    %changelog
    
    %preun
    rm -rf /usr/lib/systemd/system/kafka.service
    rm -rf /data/apps/kafka
    
    
    # Build-RPM安装包
    rpmbuild -bb kafka.spec
    ll ../RPMS/noarch/
    -rw-r--r-- 1 root root 60979828 Feb 23 11:29 kafka_2.11-2.1.0-1.noarch.rpm
    
    QQ:1061767621 Q群:215481318
  • 相关阅读:
    标签和过滤器
    【android】简单的布局和控件&简单的练习作品
    【android】配置模拟器以及第一个“Hello World!”
    【android】sdk安装及环境变量配置、android studio的安装及新建项目
    【javaweb】库存物资管理系统思路与总结
    【java】关于异常处理的思考
    【作业】对于对象的课程作业
    【作业】神奇的代码,包装类Integre,100==100,129!=129
    【作业】随机数+参数可变的方法+实验任务(输出素数+使用递归,判断是否为回文+统计一篇英语问斩单词出现频率)
    【作业】三个关于java的探索和两个实验题
  • 原文地址:https://www.cnblogs.com/gaohongyu/p/14435143.html
Copyright © 2020-2023  润新知