?? inspect.in
字號:
#! @BASH@# This script is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License version 2 as# published by the Free Software Foundation.## See the COPYING and AUTHORS files for more details.: ${QUILT_DIR=@QUILT_DIR@}if ! [ -r $QUILT_DIR/scripts/patchfns ]then echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2 exit 1fi. $QUILT_DIR/scripts/patchfnscd ${SUBDIR:-.}usage() { echo "Usage: ${0##*/} specfile" exit 1}if [ "$1" = -v ]then verbose=1 shiftfispecfile=$1if [ $# -ne 1 -o ! -f "$specfile" ]then usagefiif [ "${specfile:0:1}" != / ]then specfile="$PWD/$specfile"fisourcedir=${specfile%/*}tmpdir="$(gen_tempfile -d ${TMPDIR-/var/tmp}/${0##*/})"mkdir -p $tmpdir || exit 1trap "rm -rf $tmpdir" EXITmkdir -p $tmpdir/buildmkdir -p $tmpdir/bin# Redirect file descriptorsif [ -n "$verbose" ]then exec 3>&1 4>/dev/nullelse exec 3>&1 4>&2 2>/dev/nullfi# create md5 sums, also for uncompressed filesecho -n "### md5sum: " >&4shopt -s nullglobfor file in *do file=${file##*/} case "$file" in ready|bigpack|MD5SUMS|MD5SUMS.meta|*.spec|*.changes) continue ;; esac [ -f "$file" ] || continue echo -n "." >&4 echo "md5sum < $file" >&2 set -- $(md5sum < "$file") echo "$1 $file" case "$(file -b "$file")" in compress*|gzip*) echo -n "g" >&4 echo "gzip -cd $file | md5sum" >&2 set -- $(gzip -cd "$file" | md5sum) echo "$1 $file" ;; bzip2*) echo -n "b" >&4 echo "bzip2 -cd $file | md5sum" >&2 set -- $(bzip2 -cd "$file" | md5sum) echo "$1 $file" ;; esacdone > $tmpdir/md5sumsecho >&4shopt -u nullglob# wrapper script for patch and tarcat <<-'EOF' > $tmpdir/bin/wrapper #! @BASH@ # find original data file by md5sum original_file() { local file=$1 md5sum set -- $(md5sum < $file) md5sum=$1 while read md5sum_ file_ do if [ $md5sum = $md5sum_ ] then echo ${file_#\*} return 0 fi done < $tmpdir/md5sums # Try harder if ! [ -e $tmpdir/more-md5sums ] then ( cd $RPM_BUILD_DIR find . -type f \ | sed -e 's:^.\/::' \ | xargs md5sum \ ) > $tmpdir/more-md5sums fi while read md5sum_ file_ do if [ $md5sum = $md5sum_ ] then echo ${file_#\*} return 0 fi done < $tmpdir/more-md5sums return 1 } # Extract the -p option from the command line strip_option() { while [ $# -ne 0 -a "${1:0:2}" != -p ] do shift done if [ "${1:0:2}" = -p ] then [ "$1" = -p ] && set -- "$1$2" [ "$1" != -p1 ] && echo $1 fi } patch_input_file() { while [ $# -gt 0 ]; do case "$1" in -i|--input) if [ $# -ge 2 ]; then echo "$2" return fi ;; -i*) echo "${1#-i}" return ;; --input=*) echo "${1#--input=}" return ;; esac shift done return 1 } tar_input_file() { while [ $# -gt 0 ]; do if [ -e "$1" ] then echo "$1" return fi shift done } tmpdir=${RPM_BUILD_DIR%/*} rm -f $tmpdir/data case "${0##*/}" in patch) inputfile=$(patch_input_file "$@") ;; tar) inputfile=$(tar_input_file "$@") ;; esac if [ -z "$inputfile" ]; then # put data from stdin into tmpfile cat > $tmpdir/data fi unpackfile="$(original_file ${inputfile:-$tmpdir/data})" if [ -n "$unpackfile" ] then dir=${PWD/$RPM_BUILD_DIR} dir=${dir##/} case "${0##*/}" in patch) echo -n p >&4 echo "${0##*/} ${dir:-.} $unpackfile" \ $(strip_option "$@") >&3 ;; tar) echo -n t >&4 echo "${0##*/} ${dir:-.} $unpackfile" >&3 ;; esac fi PATH=${PATH#*:} if [ -n "$inputfile" ]; then ${0##*/} "$@" else ${0##*/} "$@" < $tmpdir/data fiEOFchmod 755 $tmpdir/bin/wrapperln -s wrapper $tmpdir/bin/patchln -s wrapper $tmpdir/bin/tar# let rpm do all the dirty specfile stuff ...echo -n "### rpmbuild: " >&4export PATH="$tmpdir/bin:$PATH"rpmbuild --eval "%define _sourcedir $sourcedir" \ --eval "%define _specdir $sourcedir" \ --eval "%define _builddir $tmpdir/build" \ --nodeps \ -bp "$specfile" < /dev/null >&2status=$?echo >&4exit $status### Local Variables:### mode: shell-script### End:# vim:filetype=sh
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -