Annotation of src/usr.bin/ctfconv/ctfstrip, Revision 1.1
1.1 ! mpi 1: #!/bin/sh
! 2:
! 3: # Turn off Strict Bourne shell mode.
! 4: set +o sh
! 5:
! 6: USAGE="usage: ${0##*/} [-S] [-o outfile] file"
! 7:
! 8: while getopts "o:S" opt; do
! 9: case $opt in
! 10: S) STRIPFLAG=-g;;
! 11: o) OUTFILE="${OPTARG}";;
! 12: *) print -u2 "${USAGE}"; exit 1;;
! 13: esac
! 14: done
! 15: shift $((OPTIND-1))
! 16:
! 17: if [[ $# == 0 ]]; then
! 18: print -u2 "${USAGE}";
! 19: exit 1
! 20: fi
! 21:
! 22: LABEL="unknown"
! 23: TMPFILE=$1.rawctf
! 24:
! 25: # Extract kernel verison
! 26: if [[ "$1" == bsd* ]]; then
! 27: LABEL=`what $1 |tr -d '\n'|awk -F"$1 " '{ print $2 '\n' }'`
! 28: fi
! 29:
! 30: ctfconv -o ${TMPFILE} -l "${LABEL}" $1 || exit 2
! 31:
! 32: objcopy --add-section .SUNW_ctf=${TMPFILE} ${STRIPFLAG} $1 ${OUTFILE}
! 33:
! 34: rm -f ${TMPFILE}