From 9107163f6872180bc9326e7cb59e2453d2203c49 Mon Sep 17 00:00:00 2001 From: jingxuanzhang Date: Mon, 2 Mar 2020 18:02:56 -0500 Subject: [PATCH] Add patch generation scripts Signed-off-by: jingxuanzhang --- utils/gen_patch_kar.sh | 55 ++++++++++++++++++++++++++++++++++++++++++ utils/install_patch.sh | 13 ++++++++++ 2 files changed, 68 insertions(+) create mode 100755 utils/gen_patch_kar.sh create mode 100755 utils/install_patch.sh diff --git a/utils/gen_patch_kar.sh b/utils/gen_patch_kar.sh new file mode 100755 index 00000000..1ec27706 --- /dev/null +++ b/utils/gen_patch_kar.sh @@ -0,0 +1,55 @@ +############################################################################## +# Copyright (c) 2020 OpenALTO. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v1.0 which accompanies this distribution, +# and is available at http://www.eclipse.org/legal/epl-v10.html +############################################################################## +#!/bin/bash + +cd $(dirname $0)/.. +PROJECT_ROOT=$(pwd) +KAR_ROOT=$PROJECT_ROOT/alto-karaf/target/assembly +ALTO_KAR_ROOT=$KAR_ROOT/system/org/opendaylight/alto + +generate_patch() { + TMP_DIR=$(mktemp -d) + TMP_PATCH_ROOT=$TMP_DIR/odl-alto-patch + cp -r $ALTO_KAR_ROOT $TMP_PATCH_ROOT/ + cp $PROJECT_ROOT/utils/install_patch.sh $TMP_PATCH_ROOT/ + pushd $TMP_DIR + zip -r odl-alto-patch odl-alto-patch + mkdir -p $1 + echo "Putting patch archieve to $1" + mv odl-alto-patch.zip $1/ + popd + rm -rf $TMP_DIR +} + +usage() { + echo "Usage: $0 [option]" + echo "" + echo "Options:" + echo " directory to put the patch" + echo " help display help information" +} + +if [ -z $1 ]; then + usage + exit 0 +fi + +case $1 in + help) + usage + ;; + *) + # Generate patch to directory + if [ -d $ALTO_KAR_ROOT ]; then + generate_patch $(realpath $1) + else + echo "$ALTO_KAR_ROOT not found" + echo "Please build alto-karaf first" + exit -1 + fi +esac diff --git a/utils/install_patch.sh b/utils/install_patch.sh new file mode 100755 index 00000000..1f03320a --- /dev/null +++ b/utils/install_patch.sh @@ -0,0 +1,13 @@ +############################################################################## +# Copyright (c) 2020 OpenALTO. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v1.0 which accompanies this distribution, +# and is available at http://www.eclipse.org/legal/epl-v10.html +############################################################################## +#!/bin/bash + +cd $(dirname $0) +KARAF_ROOT=$1 + +cp -r alto/* $KARAF_ROOT/system/org/opendaylight/alto/