42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk#!/bin/bash
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk#
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden# Copyright 2010-2015 ForgeRock AS.
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk#
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# The contents of this file are subject to the terms
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# of the Common Development and Distribution License
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# (the License). You may not use this file except in
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# compliance with the License.
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk#
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# You can obtain a copy of the License at
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# http://forgerock.org/license/CDDLv1.0.html
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# See the License for the specific language governing
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# permission and limitations under the License.
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk#
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# When distributing Covered Code, include this CDDL
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# Header Notice in each file and include the License file
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# at http://forgerock.org/license/CDDLv1.0.html
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# If applicable, add the following below the CDDL Header,
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# with the fields enclosed by brackets [] replaced by
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# your own identifying information:
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# "Portions Copyrighted [year] [name of copyright owner]"
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# This script creates the cut down OpenDJ.zip for inclusion in the build
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk# OpenDJ libraries must be copied into extlib manually
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkSED=`which sed`
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkUNZIP=`which unzip`
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkZIP=`which zip`
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkZIP_FILE=opendj.zip
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkLIST=opendj_inclusion_list
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis PappLDIF=template/ldif/
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkLDIF_FILE=openam_suffix.ldif.template
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis PappCONFIG=template/config/config.ldif
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis PappCONFIG_UPGRADE_DIR=./template/config/upgrade/
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkif [ -z ${@} ] ; then
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk echo "Error! No command line argument supplied"
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk echo "Usage: ./create_opendj_zip.sh OPENDJ_FOLDER"
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk exit -1;
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkfi
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkPWD=`pwd`
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkcd "${@}"
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkcp ../${LDIF_FILE} ${LDIF}
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Pappfor i in ${CONFIG} template/config/config.ldif ; do
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk ${SED} -i -e '/dn: cn=SNMP/,/^$/d' $i
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkdone
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp#add a config.ldif.${VERSION_NO} file to the upgrade
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp#directory for easy upgrading from Pre-OPENDJ2.4.5 versions
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis PappVERSION_NO=`ls ${CONFIG_UPGRADE_DIR} | sed s/"[a-z/.]*//"`
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Pappcp ${CONFIG} ${CONFIG_UPGRADE_DIR}"config.ldif."$VERSION_NO
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk${ZIP} -r -i@../${LIST} ../${ZIP_FILE} .
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenkcd ${PWD}
42a4017e9363f11617b05dfb9a99b90460194220jeff.schenk