| #!/bin/sh |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| usage="usage: $0 --spec_header '/path/to/os-base-header.spec' \n" |
| usage="$usage\t[--find_provides '/path/to/find-provides']\n" |
| usage="$usage\t[--shlib_dirs 'dirs:which:contain:shared:libs']\n" |
| usage="$usage\t[--ignore_dirs 'grep-E|pattern|of|paths|to|ignore']\n" |
| |
| |
| |
| |
| usage="$usage\t[--interp_dirs 'dirs:which:contain:interpreters']\n" |
| usage="$usage\t[--interps 'files:to:assume:are:installed']\n" |
| usage="$usage\t[--no_verify]\n" |
| |
| |
| |
| |
| |
| sum_cmd="xargs cksum" |
| |
| date=`date` |
| hostname=`uname -n` |
| |
| |
| |
| |
| |
| |
| PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd |
| export PATH |
| |
| |
| |
| |
| |
| spec_header='/usr/lib/rpm/os-base-header.spec'; |
| interps="sh:csh:ksh:dtksh:wish:tclsh:perl:awk:gawk:nawk:oawk" |
| find_provides='/usr/lib/rpm/find-provides'; |
| |
| |
| |
| |
| ignore_dirs="@" |
| |
| |
| osname=`uname -s` |
| if test $? -ne 0 || test X$osname = X ; then |
| echo "I can't determine what platform this is. Exiting" |
| exit 1 |
| fi |
| |
| |
| |
| |
| |
| case $osname in |
| OSF1) |
| shlib_dirs='/shlib:/usr/shlib:/usr/dt/lib:/usr/opt' |
| interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin:/usr/bin/posix' |
| ;; |
| HP-UX) |
| shlib_dirs='/usr/shlib:/usr/dt/lib:/opt' |
| shlib_dirs="$shlib_dirs:/usr/bms:/usr/obam:/usr/sam" |
| interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin:/usr/bin/posix' |
| ;; |
| AIX) |
| shlib_dirs='/usr/lib:/usr/ccs/lib:/usr/dt/lib:/usr/lpp:/usr/opt' |
| interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin' |
| ;; |
| SunOS) |
| shlib_dirs='/etc/lib:/etc/vx:/opt:/usr/lib:/usr/ccs/lib:/usr/dt/lib' |
| shlib_dirs="$shlib_dirs:/usr/4lib:/usr/openwin/lib:/usr/snadm/lib" |
| shlib_dirs="$shlib_dirs:/usr/ucblib:/usr/xpg4/lib" |
| interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin:/usr/xpg4/bin' |
| ;; |
| IRIX|IRIX64) |
| shlib_dirs='/lib:/usr/lib:/usr/lib32:/usr/lib64' |
| |
| shlib_dirs="$shlib_dirs:/usr/ToolTalk:/usr/xfsm:/usr/SpeedShop" |
| shlib_dirs="$shlib_dirs:/usr/sgitcl:/usr/SGImeeting:/usr/pcp/lib" |
| shlib_dirs="$shlib_dirs:/usr/Motif-2.1" |
| interp_dirs='/bin:/usr/bin:/sbin:/usr/sbin:/usr/dt/bin' |
| ;; |
| *) |
| echo "I'm sorry. I haven't been configured yet to work on $osname." |
| echo "Please poke around your system and try figure out what directories" |
| echo "I should be searching for shared libraries. Once you have this" |
| echo "information, email it to rpm-list@redhat.com, so that your OS" |
| echo "will be supported by some future version of this script." |
| echo "" |
| echo "Thanks!" |
| echo |
| exit 2 |
| ;; |
| esac |
| |
| |
| |
| |
| |
| |
| while : |
| do |
| |
| |
| case $# in |
| 0) |
| break |
| ;; |
| esac |
| |
| |
| option=$1 |
| shift |
| |
| |
| orig_option=$option |
| case $option in |
| --*) ;; |
| -*) option=-$option ;; |
| esac |
| |
| |
| case $option in |
| --spec_header) |
| spec_header=$1 |
| shift |
| ;; |
| --ignore_dirs) |
| ignore_dirs=$1 |
| shift |
| ;; |
| --find_provides) |
| find_provides=$1 |
| shift |
| ;; |
| --shlib_dirs) |
| shlib_dirs=$1 |
| shift |
| ;; |
| --interp_dirs) |
| interp_dirs=$1 |
| shift |
| ;; |
| --interps) |
| interps=$1 |
| shift |
| ;; |
| --no_verify) |
| no_verify=1 |
| ;; |
| --help) |
| echo $usage |
| exit 0 |
| ;; |
| *) |
| echo "$0: Unrecognized option: \"$orig_option\"; use --help for usage." >&2 |
| exit 1 |
| ;; |
| esac |
| done |
| |
| |
| |
| |
| if [ ! -f $spec_header ]; then |
| echo "You must pass me the full path to the partial spec file" |
| echo "as my first argument, since this file does not appear in the" |
| echo "default location of $default_spec_header" |
| echo |
| echo $usage |
| echo |
| exit 9 |
| fi |
| |
| |
| if [ ! -f $find_provides ]; then |
| echo "You must pass me the full path to the find-provides script as my" |
| echo "second argument, since find-provides does not appear in the" |
| echo "default location of $default_find_provides" |
| echo |
| echo $usage |
| echo |
| exit 9 |
| fi |
| |
| |
| |
| provides_tmp=${TMPDIR:-/tmp}/provides.$$ |
| if test -f $provides_tmp ; then |
| echo "$provides_tmp already exists. Exiting." |
| exit 11 |
| fi |
| |
| |
| |
| |
| |
| for d in `echo $shlib_dirs | sed -e 's/:/ /g'` |
| do |
| find $d -type f -print 2>/dev/null | grep -E -v \'$ignore_dirs\' | $find_provides >> $provides_tmp |
| done |
| |
| sum_tmp=${TMPDIR:-/tmp}/sum.$$ |
| if test -f $sum_tmp ; then |
| echo "$sum_tmp already exists. Exiting." |
| exit 11 |
| fi |
| |
| |
| |
| |
| for d in `echo $shlib_dirs | sed -e 's/:/ /g'` |
| do |
| find $d -type f -print 2>/dev/null | grep -E -v \'$ignore_dirs\' | $sum_cmd >> $sum_tmp |
| done |
| |
| |
| |
| |
| |
| cat $spec_header |
| |
| |
| |
| |
| { |
| |
| |
| |
| for f in `cat $provides_tmp | sort -u` |
| do |
| echo "Provides: $f" |
| done |
| |
| |
| |
| |
| for d in `echo $interp_dirs | sed -e 's/:/ /g'` |
| do |
| for f in `echo $interps | sed -e 's/:/ /g'` |
| do |
| if test -f $d/$f ; then |
| echo "Provides: $d/$f" |
| fi |
| done |
| done |
| } | sed -e 's/%/%%/g' |
| |
| |
| |
| |
| |
| cat <<_EIEIO_ |
| |
| |
| %description |
| This is a virtual RPM package. It contains no actual files. It uses the |
| \`Provides' token from RPM 3.x and later to list many of the shared libraries |
| and interpreters that are part of the base operating system and associated |
| OS packages for $osname. |
| |
| This virtual package was constructed based on the vendor/system software |
| installed on the '$osname' machine named '$hostname', as of the date |
| '$date'. |
| |
| Input to the script: |
| |
| spec_header=$spec_header |
| ignore_dirs=$ignore_dirs |
| find_provides=$find_provides |
| shlib_dirs=$shlib_dirs |
| interp_dirs=$interp_dirs |
| interps=$interps |
| |
| _EIEIO_ |
| |
| # |
| # Output the build sections of the spec file |
| # |
| |
| echo '%prep' |
| echo ' |
| echo '%build' |
| echo '# nothing to do' |
| echo '%install' |
| echo '# nothing to do' |
| echo '%clean' |
| echo '# nothing to do' |
| |
| if [ -z "${no_verify}" ]; then |
| |
| |
| |
| |
| |
| cat <<_EIEIO_ |
| |
| %verifyscript |
| |
| PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd |
| export PATH |
| |
| sum_current_tmp=\${TMPDIR:-/tmp}/rpm.sum.current.\$\$ |
| if test -f \$sum_current_tmp ; then |
| echo "\$sum_current_tmp already exists. Exiting." |
| exit 11 |
| fi |
| |
| sum_package_tmp=\${TMPDIR:-/tmp}/rpm.sum.package.\$\$ |
| if test -f \$sum_package_tmp ; then |
| echo "\$sum_package_tmp already exists. Exiting." |
| exit 11 |
| fi |
| |
| for d in `echo $shlib_dirs | sed -e 's/:/ /g'` |
| do |
| find \$d -type f -print 2>/dev/null | grep -E -v \'$ignore_dirs\' | $sum_cmd >> \$sum_current_tmp |
| done |
| |
| cat >\$sum_package_tmp <<_EOF_ |
| _EIEIO_ |
| |
| |
| |
| |
| cat $sum_tmp | sed -e 's/%/%%/g' |
| |
| cat <<_EIEIO_ |
| _EOF_ |
| |
| |
| cmp \$sum_package_tmp \$sum_current_tmp |
| |
| if [ \$? -ne 0 ]; then |
| echo"Differences found by: cmp \$sum_package_tmp \$sum_current_tmp" |
| exit \$? |
| fi |
| |
| _EIEIO_ |
| |
| |
| fi |
| |
| |
| |
| |
| |
| echo '%files' |
| echo '# no files in a virtual package' |
| |
| exit 0 |