create.sh revision 34ce5c2f0e9b0f6bf05895501c9f7171d4a5bab7
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# CDDL HEADER START
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# The contents of this file are subject to the terms of the
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# Common Development and Distribution License (the "License").
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# You may not use this file except in compliance with the License.
e7b21c8124ec55ffacc49c1e28a8685834715484Lubos Kosco# See LICENSE.txt included in this distribution for the specific
e7b21c8124ec55ffacc49c1e28a8685834715484Lubos Kosco# language governing permissions and limitations under the License.
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# When distributing Covered Code, include this CDDL HEADER in each
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# If applicable, add the following below this CDDL HEADER, with the
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# fields enclosed by brackets "[]" replaced with your own identifying
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# information: Portions Copyright [yyyy] [name of copyright owner]
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# CDDL HEADER END
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo "Usage: $0 -v <version>"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo "Usage: $0 -v <version>"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comif [ ! "$human_readable_version" ]
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo "Cannot identify the version"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# Transform OpenGrok version to the IPS version standard
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12 ~ 0.12.0.1.0
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.<n> ~ 0.<n>.0.1.0
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12-rc1 ~ 0.12.0.0.1
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12-rc<i> ~ 0.12.0.0.<i>
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# Note that the release candidate must follow imediately after the basic version number (0.12)
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12.1 ~ 0.12.1.0.0
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12.<j> ~ 0.12.<j>.0.0
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12.0.1 ~ 0.12.0.1.1
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# 0.12.0.<k> ~ 0.12.0.1.<k>
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# This is done due to IPS restriction on the version's names
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# This also keep the order of picking the versions from repository
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comversion=$(echo "$human_readable_version" | nawk -F"." '
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comfunction parse ( version )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com if ( version ~ /^[0-9]+\.[0-9]+-rc[0-9]+/ )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com ret = $1".0.0."$2;
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com else if ( version ~ /^[0-9]+\.[0-9]+$/ )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com return version".0.1.0";
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com else if ( version ~ /^[0-9]+\.[0-9]+\.[0-9]+$/ )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com if ( $3 == "0" )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com return version"."ret".0";
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com else if ( version ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com for ( i = 2; i < 4; i ++ )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com return ret".1."$NF;
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com else if ( version ~ /rc/ )
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com print parse($0);
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo "Command failed: nawk ..."
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo "Not supported naming scheme $version"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# create local repo
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo Command failed: mkdir -p "$PKG_REPO_NAME"
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye if [ $? != 0 ]
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgrepo create "$PKG_REPO_NAME"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgrepo -s "$PKG_REPO_NAME" set publisher/prefix=${PKG_PUBLISHER}
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comeval `pkgsend open ${PKG_NAME}@${version}`
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbyeif [ $? != 0 ]
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com echo "Fatal: could not open ${PKG_NAME}@${version}"
d3f4f9ed01f6a0b171d0a81c630f5708e47adb7avitezslav batrla - Sun Microsystems - Prague Czech Republicfor dir in /etc/opengrok /usr/opengrok /usr/opengrok/man /usr/opengrok/man/man1\
d3f4f9ed01f6a0b171d0a81c630f5708e47adb7avitezslav batrla - Sun Microsystems - Prague Czech Republic /usr/opengrok/doc
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com PKG pkgsend add dir mode=0755 owner=root group=sys path=${dir}
d3f4f9ed01f6a0b171d0a81c630f5708e47adb7avitezslav batrla - Sun Microsystems - Prague Czech Republicfor dir in /usr/opengrok/bin /usr/opengrok/lib
d3f4f9ed01f6a0b171d0a81c630f5708e47adb7avitezslav batrla - Sun Microsystems - Prague Czech Republicdo
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com PKG pkgsend add dir mode=0755 owner=root group=bin path=${dir}
d3f4f9ed01f6a0b171d0a81c630f5708e47adb7avitezslav batrla - Sun Microsystems - Prague Czech Republicdone
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbyefor dir in /var/opengrok /var/opengrok/data /var/opengrok/etc \
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com PKG pkgsend add dir mode=0755 owner=webservd group=webservd path=${dir}
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add link path=/usr/opengrok/lib/lib target=../lib
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file platform/solaris/smf/opengrok.xml mode=0444 owner=root group=sys path=/var/svc/manifest/application/opengrok.xml restart_fmri=svc:/system/manifest-import:default
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file platform/solaris/smf/svc-opengrok mode=0555 owner=root group=bin path=/lib/svc/method/svc-opengrok
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file platform/solaris/smf/ogindexd mode=0555 owner=root group=bin path=/usr/opengrok/lib/ogindexd
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file OpenGrok mode=0555 owner=root group=bin path=/usr/opengrok/bin/OpenGrok
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file dist/opengrok.jar mode=0444 owner=root group=bin path=/usr/opengrok/lib/opengrok.jar
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file logging.properties mode=0444 owner=root group=sys path=/usr/opengrok/doc/logging.properties
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file README.txt mode=0444 owner=root group=sys path=/usr/opengrok/doc/README.txt
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file CHANGES.txt mode=0444 owner=root group=sys path=/usr/opengrok/doc/CHANGES.txt
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file LICENSE.txt mode=0444 owner=root group=sys path=/usr/opengrok/doc/LICENSE.txt
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file NOTICE.txt mode=0444 owner=root group=sys path=/usr/opengrok/doc/NOTICE.txt
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file doc/EXAMPLE.txt mode=0444 owner=root group=sys path=/usr/opengrok/doc/EXAMPLE.txt
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file doc/ctags.config mode=0444 owner=root group=sys path=/usr/opengrok/doc/ctags.config
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# install libs
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com lucene-analyzers-common-${LV}.jar lucene-core-${LV}.jar lucene-queryparser-${LV}.jar lucene-suggest-${LV}.jar \
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com PKG pkgsend add file dist/lib/${file} mode=0444 owner=root group=bin path=/usr/opengrok/lib/${file}
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# install man page
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add file dist/opengrok.1 mode=0444 owner=root group=bin path=/usr/opengrok/man/man1/opengrok.1
d20db9dd18673cf482111b9cd3ecc6823d0e45a3Trond Norbye# install default configuration
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add depend fmri=pkg:/runtime/java type=require
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add depend fmri=pkg:/web/java-servlet/tomcat type=require
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# Following line gets commented by that the developer/tool/exuberant-ctags has been removed from IPS
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# This has to stay commented until the next release of Solaris will contain the exhuberant ctags package
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com#PKG pkgsend add depend fmri=pkg:/developer/tool/exuberant-ctags type=require
f480a2c90c9bf75c2eded1a0577a65b262970552Vladimir KotalPKG pkgsend add file dist/source.war mode=0444 owner=webservd group=webservd path=/usr/opengrok/lib/source.war
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add set name=description value="OpenGrok - wicked fast source browser"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comPKG pkgsend add set name=pkg.human-version value="${human_readable_version}"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com# checks whether the same file exists and updates it
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comif [ -f "${PKG_NAME}-${human_readable_version}.p5p" ]
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.com rm -f ${PKG_NAME}-${human_readable_version}.p5p
f480a2c90c9bf75c2eded1a0577a65b262970552Vladimir Kotaloutfile="$PWD/dist/${PKG_NAME}-${human_readable_version}.p5p"
f480a2c90c9bf75c2eded1a0577a65b262970552Vladimir KotalPKG pkgrecv -s "$PKG_REPO_NAME" -a -d "${outfile}" ${PKG_NAME}
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comecho "SUCCESSFULLY COMPLETED"
f480a2c90c9bf75c2eded1a0577a65b262970552Vladimir Kotalecho "OpenGrok has been packaged into $outfile"
8bdb629053c6752f21668f2af5f336109439b15bkrystof.tulinger@oracle.comecho "For more information about installing OpenGrok visit pkg man page."