VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/nsprpub/pkg/solaris/bld_awk_pkginfo.ksh@ 11551

Last change on this file since 11551 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1#!/usr/bin/ksh -p
2#
3#ident "$Id: bld_awk_pkginfo.ksh 1 1970-01-01 00:00:00Z vboxsync $"
4#
5# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
6# Use is subject to license terms.
7#
8# Simple script which builds the awk_pkginfo awk script. This awk script
9# is used to convert the pkginfo.tmpl files into pkginfo files
10# for the build.
11#
12
13usage()
14{
15 cat <<-EOF
16usage: bld_awk_pkginfo -p <prodver> -m <mach> -o <awk_script> [-v <version>]
17EOF
18}
19
20#
21# Awk strings
22#
23# two VERSION patterns: one for Dewey decimal, one for Dewey plus ,REV=n
24# the first has one '=' the second has two or more '='
25#
26VERSION1="VERSION=[^=]*$"
27VERSION2="VERSION=[^=]*=.*$"
28PRODVERS="^SUNW_PRODVERS="
29ARCH='ARCH=\"ISA\"'
30
31#
32# parse command line
33#
34mach=""
35prodver=""
36awk_script=""
37version="NSPRVERS"
38
39while getopts o:p:m:v: c
40do
41 case $c in
42 o)
43 awk_script=$OPTARG
44 ;;
45 m)
46 mach=$OPTARG
47 ;;
48 p)
49 prodver=$OPTARG
50 ;;
51 v)
52 version=$OPTARG
53 ;;
54 \?)
55 usage
56 exit 1
57 ;;
58 esac
59done
60
61if [[ ( -z $prodver ) || ( -z $mach ) || ( -z $awk_script ) ]]
62then
63 usage
64 exit 1
65fi
66
67if [[ -f $awk_script ]]
68then
69 rm -f $awk_script
70fi
71
72#
73# Build REV= field based on date
74#
75rev=$(date "+%Y.%m.%d.%H.%M")
76
77#
78# Build awk script which will process all the
79# pkginfo.tmpl files.
80#
81# the first VERSION pattern is replaced with a leading quotation mark
82#
83rm -f $awk_script
84cat << EOF > $awk_script
85/$VERSION1/ {
86 sub(/\=[^=]*$/,"=\"$rev\"")
87 print
88 next
89 }
90/$VERSION2/ {
91 sub(/\=[^=]*$/,"=$rev\"")
92 sub(/NSPRVERS/,"$version")
93 print
94 next
95 }
96/$PRODVERS/ {
97 printf "SUNW_PRODVERS=\"%s\"\n", "$prodver"
98 next
99 }
100/$ARCH/ {
101 printf "ARCH=\"%s\"\n", "$mach"
102 next
103 }
104{ print }
105EOF
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette