将源码包制作成rpm包时,build和install时需要make,makeinstall。
目录创建
mkdir -pv ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,BUILDROOT}
SOURCES下放源码包,压缩包或文件夹。
SPECS下创建.spec。
SPEC文件编辑
node文件解压
作用,将node解压到/opt/node目录
name: node
Version: v14.16.0
Summary: nodejs
Release: 1
Source0:%{name}-%{version}.tar.gz
Packager: hanw
#BuildRequires:
#Requires:
License: GPLv3+
%description
nodejs arm rpm package
%prep
%global debug_package %{nil}
%setup -q
%build
%install
rm -rf %{buildroot}/opt/%{name}
mkdir -p %{buildroot}/opt/%{name}
cp -rf %_topdir/BUILD/%{name}-%{version}/* %{buildroot}/opt/%{name}
%clean
rm -rf %_builddir/%{name}-%{version}
rm -rf %{buildroot}
%files
%defattr(777,root,root)
/opt/%{name}
写入sh脚本
#DEFINES
%define _binaries_in_noarch_packages_terminate_build 0
%global __os_install_post %{nil}
Name: sh
Version: 1
Release: 1
Summary: Rpm package for sh
License: ASL 2.0
Source0: sh/
BuildArch: noarch
AutoReqProv: no
%description
%{summary}
%description
Rpm package for rpash
%install
app_dir=%{buildroot}/opt/eap
# cleanup build root
rm -rf %{buildroot}
mkdir -p %{buildroot}
# create app folder
mkdir -p $app_dir
# copy all files
echo pwd
echo %{SOURCE0}
cp -r %{SOURCE0}/sh $app_dir/
##### FILES SECTION #####
%files
%defattr(777,root,root)
/opt
%dir
/opt
安装rpa包
rpm -ivh xxxx.rpm --nodeps --force
参考链接
源码包制作rpm包参考:https://www.jianshu.com/p/ccf328178b80
spec文件参数:https://blog.csdn.net/yuelai_217/article/details/130722081
参考1:https://blog.csdn.net/Michaelwubo/article/details/105886315
参考2:https://www.qyyshop.com/info/1131482.html
标签:opt,buildroot,name,nodejs,rpm,rf,root,制作 From: https://blog.51cto.com/u_15785525/7409699