rpm简单制作

我对linux一窍不通,可前段时间由于客户需要,要求给他们一个RPM版本,本人咬牙切齿鼓捣了两天,终于应付过去(这不是本人一贯作风,以后有机会仔细研究一下linux的基本操作)。

 

RPM打包是使用的linux的rpm build工具,如果命令行中提示“rpmbuild : command not found”,那是因为系统没有安装rpm build工具,这个工具一般在安装光盘中。

下面对整个实现过程简单描述一下:

  1. 资源放置:usr/src/redhat/build 下面有多个文件
    tar.gz包放到resources下,spec文件放到specs下
  2. 然后执行打包程序

使用到的linux命令有:

  1. rpm打包: rpmbuild -ba *.spec
  2. rpm安装tar.gz文件:rpm -ivh *.tar.gz
  3. rpm卸载tar.gz文件:rpm -e * 注意:一定不要带发版号和后缀,如ISStudio-6.0.0-1.i386.rpm,要使用rpm -e ISStudio-6.0.0
  4. 移除文件:rm -rf 文件名

spec文件示例:

Summary:   The Install Package for InforSuite Studio on Linux
Name:      ISStudio
Version:   6.0.0
Release:   1
License:   Commercial
Group:     Applications/Editors
Source:    inforsuite-studio.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Url:       http://www.inforbus.com
Packager:  CVICSE
Prefix:    %{_prefix}
Prefix:    %{_sysconfdir}
%define    userpath /home/CVICSE

%description
InforSuite Studio is one of the CVICSE's Products锛宨t provides a development environment for support CVICSE's midllewares: inforflow & inforsib, and so on.Beside, we also provide some excellet tool for JEE develop, for example, the Develop Platform supports UML,MDA,Struts,Hibernate,Spring developing. 

%prep
%setup -c
%install
install -d $RPM_BUILD_ROOT%{userpath}
#cp -a %{name}* $RPM_BUILD_ROOT%{userpath}
cp -a * $RPM_BUILD_ROOT%{userpath}

%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%{name}-%{version}

%files
%defattr(-,root,root)
%{userpath}

%post
cat > ~/Desktop/ISStudio.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=ISStudio
Exec=%{userpath}/eclipse/eclipse
Icon=%{userpath}/ISStudio/resources/eclipse.png
Categories=Application;Development;
Version=6.0.0
StartupNotify=true
Type=Application
Terminal=false
EOF
cp -a ~/Desktop/ISStudio.desktop /usr/share/applications
%postun
rm ~/Desktop/ISStudio.desktop
rm /usr/share/applications/ISStudio.desktop

%changelog
* Wed Mar 12 2008 zhu_qhua
  - InforSuite Studio project to RPM build spec-file

 

参考: http://blog.csdn.net/yueyinggufan/archive/2009/08/21/4469000.aspx

http://wiki.netbeans.org/VestaBuild

 

 

 

 

你可能感兴趣的:(eclipse,linux,redhat,ssh,Netbeans)