1 #!/usr/bin/ksh -p 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 23 # 24 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> 25 # 26 27 WHICH_SCM=which_scm 28 CW=cw 29 NAWK=nawk 30 31 32 echo "date: $(date)" 33 echo "uname: $(uname -a)" 34 35 $WHICH_SCM | read scm_type junk || exit 1 36 cmd= 37 if [[ $scm_type == "git" ]]; then 38 cmd="git rev-parse --verify HEAD" 39 elif [[ $scm_type == "mercurial" ]]; then 40 cmd="hg log -r tip --template {node}" 41 fi 42 if [[ -n $cmd ]]; then 43 echo "scm: ${scm_type} $($cmd)" 44 fi 45 46 $CW -_versions 2>&1 | $NAWK ' 47 /^primary:/ { print; watch = 1; next; } 48 watch == 1 { print("primaryversion: " $0); watch = 0; next; } 49 /^shadow:/ { print; watch = 2; next; } 50 watch == 2 { print("shadowversion: " $0); watch = 0; next; } 51 ' 52 53 exit 0