rpmbuild


构建脚本例子

Name:     demo-tools
Version:  1.0.0
Release:  1
Summary:  demo shell tools

Group:    Applications/System
License:  GPL
URL:      http://www.zhongfu.net
BuildRoot:%{_builddir}/%{name}-root
BuildArch:noarch
AutoReqProv: no
Source0:  %{name}.tar.gz


%define __os_install_post %{nil}


%description
demo运维脚本工具

%prep
%setup -n %{name}

%install
mkdir -p $RPM_BUILD_ROOT
mkdir -p %{buildroot}/opt/github/demo-tools
/bin/cp -rf $RPM_BUILD_DIR/%{name}/*  $RPM_BUILD_ROOT/opt/github/demo-tools/


%post
chown -R root:root /opt/github/demo-tools
chmod +755 /opt/github/demo-tools/*.sh


%preun


%postun
if [ -d "/opt/github/demo-tools" ];then
   if [ $1 = '0' ];then
     rm -rf /opt/github/demo-tools
   fi
fi


%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
    /opt/github/demo-tools/*

%changelog
* Sun Jan 21 2024 MG
* 第一次构建脚本包

文章作者: huhuhuhr
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 huhuhuhr !
  目录