makerpm.sh

来自「一个很好用的Linux/Unix下Oracle OCI开发接口封装库」· Shell 代码 · 共 59 行

SH
59
字号
#!/bin/sh# This script cares for the rpm crap.# if [ `id -u` -ne 0 ]# then#    echo This command must be run as root.#    exit 1# fiif [ $# -ne 5 ]then    echo "Usage: $0 [path to rpm] [package] [package version] [awk] [prefix]"    echo 'Possible reason for failure: rpm not found?'    echo This script should preferentially be called from the Makefile only.    exit 1fiRPM=$1PACKAGE=$2VERSION=$3AWK=$4PREFIX=$5HOMEDIR=`/bin/pwd`# export RPM=/bin/rpm-2.5.5RPMVERSION=`${RPM} --version | ${AWK} '{ if ($3 < 3 ) print("2"); else print("3"); }'`if [ ${RPMVERSION} -eq 2 ]then  echo rpm version 2.x recognized  RPMSRCDIR=`$RPM --showrc | grep ^sourcedir | ${AWK} '{ print($3); }'`  SPECDIR=`$RPM --showrc | grep ^specdir | $AWK '{ print($3); }'`  BUILDDIR=`$RPM --showrc | grep ^builddir | $AWK '{ print($3); }'`else  echo rpm version 3.x recognized -- have to make educated guesses  RPMTOPDIR=/usr/src/packages/  RPMSRCDIR=${RPMTOPDIR}/SOURCES  SPECDIR=${RPMTOPDIR}/SPECS  BUILDDIR=${RPMTOPDIR}/BUILDfiSPECFILE=${SPECDIR}/${PACKAGE}.specif [ ! -x ${RPM} ]then    echo rpm should be in $RPM but not found    exit 1ficp ${HOMEDIR}/${PACKAGE}.spec ${SPECFILE}cp ${HOMEDIR}/${PACKAGE}-${VERSION}.tar.gz ${RPMSRCDIR}/${PACKAGE}-${VERSION}.tar.gzmkdir -p ${BUILDDIR}cd ${BUILDDIR}tar xzf ${HOMEDIR}/${PACKAGE}-${VERSION}.tar.gzecho Building RPMs${RPM} -ba ${SPECFILE}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?