Skip to content

Commit

Permalink
Add patch generation scripts
Browse files Browse the repository at this point in the history
Signed-off-by: jingxuanzhang <jingxuan.n.zhang@gmail.com>
  • Loading branch information
fno2010 committed Mar 2, 2020
1 parent f538621 commit 9107163
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
55 changes: 55 additions & 0 deletions utils/gen_patch_kar.sh
Original file line number Diff line number Diff line change
@@ -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 " <dir> 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
13 changes: 13 additions & 0 deletions utils/install_patch.sh
Original file line number Diff line number Diff line change
@@ -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/

0 comments on commit 9107163

Please sign in to comment.