- 执行rpmdev-setuptree,创建目录
[root@localhost ~]# rpmdev-setuptree
[root@localhost rpmbuild]# tree
.
├── BUILD
├── BUILDROOT
│ └── usr
│ └── bin
│ └── test.sh
├── RPMS
│ └── x86_64
│ └── test-1.0-1.nfs.x86_64.rpm
├── SOURCES
│ └── test.sh
├── SPECS
│ └── test.spec
└── SRPMS
└── test-1.0-1.nfs.src.rpm
- shell脚本放到SOURCES目录下
- 在SPECS目录下编写test.spec,自动生成模板,修改即可
- test.spec文件内容如下:
Name: test
Version: 1.0
Release: 1%{?dist}
Summary: shell #摘要
Group: Application/System
License: test
Source0: test.sh
Requires: bash
%description
shell
%install # 安装操作
mkdir -p %{buildroot}/usr/bin
install -m 755 %{SOURCE0} %{buildroot}/usr/bin
%pre #安装前操作
rm -rf ../RPMS/*
%files
/usr/bin/test.sh
- 执行rpmbuild -bb xxx.spec制作rpm包
[root@localhost rpmbuild]# rpmbuild -bb ./SPECS/test.spec
- 制作好的rpm包在RPMS目录下。
网友评论