rpmbuild

CentOS安装相应版本的内核源码

拈花ヽ惹草 提交于 2019-12-03 00:08:03
昨天接到同事给安排的新任务,测试系统性能;网上查了些资料,目测perf功能很强大,而且是内核源码自带的,编译安装即可使用;看了下自己的虚拟机,没有内核源码,好吧,装一个; 查看一下系统版本: 1 #cat /etc/redhat-release 2 CentOS Linux release 7.5.1804 (Core) 3 4 #uname -r 5 3.10.0-862.el7.x86_64 去CentOS官网找对应的内核源码包,下面地址,进去找到与版本信息对应的源码目录,找到内核源码包,下载即可: #http://vault.centos.org/ #wget http://vault.centos.org/7.5.1804/os/Source/SPackages/kernel-3.10.0-862.el7.src.rpm 直接使用rpm安装的话,会提示一个错误: #rpm -i kernel-3.10.0-862.el7.src.rpm Warning: user mockbuild does not exist. using root ... 这时需要安装一个mock,并新建一个mockbuild用户: #yum install mock #useradd -s /sbin/nologin mockbuild 好了,继续安装: #rpm -i kernel-3.10.0

RPM spec file - Is it possible to dynamically populate a spec file variable

巧了我就是萌 提交于 2019-12-02 21:56:43
I have a spec file. I need to %define a spec variable that gets its value from a one line file on the system. For example %define path `cat /home/user/path_file` and in path_file is one line /var/www/html/hosts This partially works. I say that begins in the RPM BUILD output sometimes the value of ${path} is literally my command cat /home/user/path_file and sometimes the value is the line in the path_file (/var/www/html/hosts) as it should be? You can define rpmbuild variables with %(cmd) at the top of the spec file. Notice the command is in parenthesis, not curly brackets. An example: %define

将源码包制作成rpm包

我们两清 提交于 2019-12-02 21:55:35
  Linux系统中一般安装软件有两种方法,源码安装和yum安装或者rpm包安装,由于光盘中的rpm包都是几年前制作成的,所以软件版本都很低,同时yum安装对软件的可定制性很低,所以为了使用最新的软件,一般都采用源码安装,但是源码安装的步骤很繁琐,所以为了简化源码安装的过程,我们一般会把源码包制作成rpm包来安装,这样不仅解决了源码安装的繁琐步骤,又增加了rpm包的可定制性。下面我们来介绍一下如何制作rpm包。 一、安装rpm-build工具   命令:yum -y install rpm-build 二、生成rpm包制作的环境   命令:rpmbuild -ba nginx.spec #这个命令执行后会报错,但是会在当前目录中生成一个rpmbuild的目录,这个目录就是制作rpm包的环境,nginx.spec这个是随便写的,但是必须以.spec结尾。 三、制作rpm包    3.1、将源码包放到/root/rpmbuild/SOURCES/目录中   3.2、生成和修改配置文件,配置文件必须放在/root/rpmbuild/SPECS/目录中,而且名字是自己定义的,但是必须以.spec结尾,如nginx.spec 保存退出   3.3、开始制作源码包 四、测试安装rpm包 查看/usr/local/中是否有nginx目录,是否能启动nginx。 来源: https://www

How to set the build area for rpmbuild per-invocation

不羁岁月 提交于 2019-12-02 15:31:39
I'm modifying an automated build, and want to tell rpmbuild to use a specific build area when invoking it . This is similar to an existing question , but more specific. I don't want to run any of the build commands as the root user; the aim is only to have an RPM, not to install anything into the system. I don't want to require the user to change their dotfiles (e.g. $HOME/.rpmrc ); the build should be self-contained and not affect the user's existing settings. I don't want to hard-code the location into the foo.spec file; that file should be useable as-is if the user wants to build in a

building RPM package: force to install in path of a dependent relocated package

自闭症网瘾萝莉.ら 提交于 2019-12-02 09:03:07
问题 I have 2 dependent packages who should be placed in the same target. Package B is dependent on package A. Package A can be relocated to any another location. I now want package B forced to be placed in the same target as package A. Or simply, package B should not be able to install without the same --prefix. Any ideas how to acieve this? I thought of putting a %pre script to check this. But thats not helpful I think, since I can't read the given "prefix" in this script - or can I? Thank you

building RPM package: force to install in path of a dependent relocated package

↘锁芯ラ 提交于 2019-12-02 02:47:55
I have 2 dependent packages who should be placed in the same target. Package B is dependent on package A. Package A can be relocated to any another location. I now want package B forced to be placed in the same target as package A. Or simply, package B should not be able to install without the same --prefix. Any ideas how to acieve this? I thought of putting a %pre script to check this. But thats not helpful I think, since I can't read the given "prefix" in this script - or can I? Thank you for your help! Hah. So I did a bit of source diving and discovered that apparently (at least for rpm 4.8

How to abort the installation of an rpm package if some conditions are not met in specfile?

时间秒杀一切 提交于 2019-12-02 01:41:07
There are some more things that the Requires tag does not satisfy. So i wrote a script to verify these things but where do I place them ? And if not found then i want to quit installation prompting user to do the steps before attempting to install this rpm again. writing exit 1 in %install tag fails to build the rpm using rpmbuild. says %install has a bad exit code. EDIT: let me provide you an example. What i initially wanted to test was is if Oracle Java 6 is present. If not then provide the path to Java6. If user fails to provide one ... exit the RPM. Higher Java is not allowed and

Disable rpmbuild automatic requirement finding

故事扮演 提交于 2019-12-01 17:59:07
The default behavior of rpmbuild seems to be to scan every file in the buildroot for #! lines and add those interpreters as hard requirements. Is it possible to disable this? I've run into a situation where people are committing scripts with #!/path/to/local/install/of/something and that requirement is becoming embedded in the rpm. I haven't been able to find a command line or spec file option that suppresses this behavior. Hopefully I just didn't look hard enough. artless noise I think the question has an answer in Where does rpm look for dependencies . At least AutoReqProv: no disables

rpmbuild simple copy of files

假如想象 提交于 2019-12-01 07:19:05
Looking for someone to just clarify the %install macro when it comes to just placing files. I created a RPM without errors that is supposed to just take files from the buildroot and cp them to /usr/lib. What I have in the SPEC file for the %install is the following, and based on this post . I though that would be enough for the rpm to copy the files from the buildroot to the /usr/lib location. This is what I tried and it builds: %install mkdir -p %{buildroot}/usr/lib install -d %{buildroot}/usr/lib/ Rethinking, I figure, well lets tell the rpm where I want to copy the files. SO I tried this:

If condition inside the %Files section on a SPEC file

拈花ヽ惹草 提交于 2019-12-01 06:23:13
I'm kinda a new to writing spec files and building RPM's. Currently I have one RPM that is supposed to deploy some files in 1 of 2 possible directories that will vary with the OS. How can I, within the %files section, verify them? I can't use variable...I can't verify both paths because one will for sure fail...I tried to define a macro earlier in the %install section but it will be defined just once and won't be redefined on every RPM installation... what can I do here? Thanks The %files section can have variables in it, but usually this would be something like your path that is defined so