一个做RPM安装包的SPEC脚本,很实用。
redhat平台打RPM包的脚本SPEC文件。---------------------------------------------------------
Summary: CorporationName appname
Name: appname
Version: 1.0.0
Release: 06242006
License: Commercial
Group: Applications/Communications
Vendor: CorporationName Coporation
Packager:authorName
URL: http://www.CorporationName.com/
Source: appname-1.0.0.tar.gz
buildroot: /usr/src/redhat/BUILD/appname-1.0.0
%description
The software is ...
%changelog
* Mon May 8 2005Orignally created the spec file
- Mon May 8 2005appname version 1.0.0
%prep
%setup -c
echo "Preparing install appname.."
%build
%post
CorporationName_DIR=/usr/local/CorporationName
appname_INSTALL_DIR=$CorporationName_DIR/mainapp
if [ ! -d $CorporationName_DIR ]; then
mkdir $CorporationName_DIR
fi
if [ ! -d $appname_INSTALL_DIR ]; then
mkdir $appname_INSTALL_DIR
fi
if [ -d $appname_INSTALL_DIR ]; then
if [ -f $appname_INSTALL_DIR/mainapp.conf ]; then
mv $appname_INSTALL_DIR/mainapp.conf $appname_INSTALL_DIR/mainapp.conf.rpmsave
fi
if [ -f $appname_INSTALL_DIR/mainappdaemon.conf ]; then
mv $appname_INSTALL_DIR/mainappdaemon.conf $appname_INSTALL_DIR/mainappdaemon.conf.rpmsave
fi
fi
install -c -m 111 -o $USERmainapp mainappdaemon $appname_INSTALL_DIR
install -c -m 666 -o $USERmainapp.conf mainappdaemon.conf $appname_INSTALL_DIR
install -c -m 111 -o $USERmainappdaemon-script /etc/rc.d/init.d/mainappdaemon
chkconfig --add mainappdaemon
chkconfig --level 2345 mainappdaemon on
ln -sf /etc/rc.d/init.d/mainappdaemon /sbin/mainapp
#echo "S0:2345:respawn:/sbin/agetty -L 38400 ttyS0" >> /etc/inittab
#echo "ttyS0" >> /etc/securetty
if [ -f /mainapp ]; then
rm -rf /mainapp
fi
if [ -f /mainapp.conf ]; then
rm -rf /mainapp.conf
fi
if [ -f /mainappdaemon ]; then
rm -rf /mainappdaemon
fi
if [ -f /mainappdaemon.conf ]; then
rm -rf /mainappdaemon.conf
fi
if [ -f /mainappdaemon-script ]; then
rm -rf /mainappdaemon-script
fi
%postun
chkconfig --level 2345 mainappdaemon off
chkconfig --del mainappdaemon
if [ -e /sbin/mainapp ]; then
rm -rf /sbin/mainapp
fi
#if [ `ps aux | grep 'mainappdaemon' | grep -v 'grep' | wc -l` -gt 0 ] then
# killall mainapp
#fi
#if [ `ps aux | grep 'mainapp' | grep -v 'grep' | wc -l` -gt 0 ] then
# killall mainapp
#fi
CorporationName_DIR=/usr/local/CorporationName
appname_INSTALL_DIR=$CorporationName_DIR/mainapp
# move mainapp files from linux system.
if [ -f $appname_INSTALL_DIR/mainapp ]; then
rm -rf $appname_INSTALL_DIR/mainapp
fi
if [ -f $appname_INSTALL_DIR/mainappdaemon ]; then
rm -rf $appname_INSTALL_DIR/mainappdaemon
fi
if [ -f /etc/rc.d/init.d/mainappdaemon ]; then
rm -rf /etc/rc.d/init.d/mainappdaemon
fi
%files
/mainapp
/mainapp.conf
/mainappdaemon
/mainappdaemon.conf
/mainappdaemon-script
----------------------------------------------
把该文件保存为spec,如app-20060624.spec,
然后执行rpmbuild -bb app-20060624.spec
在之前还需要把安装包所要安装的文件打成一个TAR包,并放到SOURCES目录下。如果研究过怎么打RPM包的话,应该知道SOURCES目录。 楼主还是抽点时间学下spec档的构成和写法 如果说模板,这也是一个极不合格的模板。 版大们,请用实例说话,请详解一下RPM打包的过程,引导一下像偶这样的众初学者们,谢谢~~~~~~~~~~~ :mrgreen::mrgreen::mrgreen: 版大们,请用实例说话,请详解一下RPM打包的过程,引导一下像偶这样的众初学者们,谢谢~~~~~~~~~~~ :mrgreen::mrgreen::mrgreen:培训版不是有置顶吗?
页:
[1]