security/nss/pkg/solaris/bld_awk_pkginfo.ksh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/usr/bin/ksh -p
michael@0 2 #
michael@0 3 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
michael@0 4 # Use is subject to license terms.
michael@0 5 #
michael@0 6 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 7 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 9 #
michael@0 10 # Simple script which builds the awk_pkginfo awk script. This awk script
michael@0 11 # is used to convert the pkginfo.tmpl files into pkginfo files
michael@0 12 # for the build.
michael@0 13 #
michael@0 14
michael@0 15 usage()
michael@0 16 {
michael@0 17 cat <<-EOF
michael@0 18 usage: bld_awk_pkginfo -p <prodver> -m <mach> -o <awk_script> [-v <version>]
michael@0 19 EOF
michael@0 20 }
michael@0 21
michael@0 22 #
michael@0 23 # Awk strings
michael@0 24 #
michael@0 25 # two VERSION patterns: one for Dewey decimal, one for Dewey plus ,REV=n
michael@0 26 # the first has one '=' the second has two or more '='
michael@0 27 #
michael@0 28 VERSION1="VERSION=[^=]*$"
michael@0 29 VERSION2="VERSION=[^=]*=.*$"
michael@0 30 PRODVERS="^SUNW_PRODVERS="
michael@0 31 ARCH='ARCH=\"ISA\"'
michael@0 32
michael@0 33 #
michael@0 34 # parse command line
michael@0 35 #
michael@0 36 mach=""
michael@0 37 prodver=""
michael@0 38 awk_script=""
michael@0 39 version="NSSVERS"
michael@0 40
michael@0 41 while getopts o:p:m:v: c
michael@0 42 do
michael@0 43 case $c in
michael@0 44 o)
michael@0 45 awk_script=$OPTARG
michael@0 46 ;;
michael@0 47 m)
michael@0 48 mach=$OPTARG
michael@0 49 ;;
michael@0 50 p)
michael@0 51 prodver=$OPTARG
michael@0 52 ;;
michael@0 53 v)
michael@0 54 version=$OPTARG
michael@0 55 ;;
michael@0 56 \?)
michael@0 57 usage
michael@0 58 exit 1
michael@0 59 ;;
michael@0 60 esac
michael@0 61 done
michael@0 62
michael@0 63 if [[ ( -z $prodver ) || ( -z $mach ) || ( -z $awk_script ) ]]
michael@0 64 then
michael@0 65 usage
michael@0 66 exit 1
michael@0 67 fi
michael@0 68
michael@0 69 if [[ -f $awk_script ]]
michael@0 70 then
michael@0 71 rm -f $awk_script
michael@0 72 fi
michael@0 73
michael@0 74 #
michael@0 75 # Build REV= field based on date
michael@0 76 #
michael@0 77 rev=$(date "+%Y.%m.%d.%H.%M")
michael@0 78
michael@0 79 #
michael@0 80 # Build awk script which will process all the
michael@0 81 # pkginfo.tmpl files.
michael@0 82 #
michael@0 83 # the first VERSION pattern is replaced with a leading quotation mark
michael@0 84 #
michael@0 85 rm -f $awk_script
michael@0 86 cat << EOF > $awk_script
michael@0 87 /$VERSION1/ {
michael@0 88 sub(/\=[^=]*$/,"=\"$rev\"")
michael@0 89 print
michael@0 90 next
michael@0 91 }
michael@0 92 /$VERSION2/ {
michael@0 93 sub(/\=[^=]*$/,"=$rev\"")
michael@0 94 sub(/NSSVERS/,"$version")
michael@0 95 print
michael@0 96 next
michael@0 97 }
michael@0 98 /$PRODVERS/ {
michael@0 99 printf "SUNW_PRODVERS=\"%s\"\n", "$prodver"
michael@0 100 next
michael@0 101 }
michael@0 102 /$ARCH/ {
michael@0 103 printf "ARCH=\"%s\"\n", "$mach"
michael@0 104 next
michael@0 105 }
michael@0 106 { print }
michael@0 107 EOF

mercurial