Added option to locally deploy - that is sometimes easier than hacking around with remote-deploy and a local ssh user

This commit is contained in:
Simon Pamies committed 2014-06-13 16:34:40 +02:00
1 parent ae93de8314
commit 11eb72ec84
1 file changed
+71 -2
+71 -2
View File
@@ -87,7 +87,7 @@ extra=''
parallelexecution=0
if [ $# -eq 0 ]; then
echo "buildAndUpdateProduct [-b -u -g -t -a -o -c -m <config> -n <package> -l <port>] [build|install|all|hot-deploy|remote-deploy|release]"
echo "buildAndUpdateProduct [-b -u -g -t -a -o -c -m <config> -n <package> -l <port>] [build|install|all|hot-deploy|remote-deploy|local-deploy|release]"
echo ""
echo "-g Disable GWT compile, no gwt files will be generated, old ones will be preserved."
echo "-b Build GWT permutation only for one browser and English language."
@@ -117,9 +117,12 @@ if [ $# -eq 0 ]; then
echo "You can overwrite the generated release name by specifying a name with the parameter -n. Do not use spaces or other special characters!"
echo "Example: $0 -w trac@sapsailing.com -n release-ess-brazil-2013 release"
echo ""
echo "hot-deploy: performs hot deployment of named bundle into OSGi server"
echo "hot-deploy: performs hot deployment of named bundle into OSGi server."
echo "Example: $0 -n com.sap.sailing.www -l 14888 hot-deploy"
echo ""
echo "local-deploy: performs deployment of one or more bundles into a local directory"
echo "Example: $0 -n com.sap.sailing.www -s /home/user/myserver local-deploy"
echo ""
echo "remote-deploy: performs hot deployment of the java code to a remote server"
echo "Example: $0 -s dev -w trac@sapsailing.com remote-deploy"
echo ""
@@ -275,6 +278,72 @@ INSTALL_FROM_RELEASE=$SIMPLE_VERSION_INFO
echo "Uploaded release to $REMOTE_HOME! Make sure to also put an updated env.sh if needed to the right place ($REMOTE_HOME/environment in most cases)"
fi
if [[ "$@" == "local-deploy" ]]; then
# check parameters
if [[ $OSGI_BUNDLE_NAME == "" ]]; then
echo "You need to provide -n parameter with bundle name."
exit 1
fi
if [ ! -d $p2PluginRepository/plugins ]; then
echo "Could not find source directory $p2PluginRepository!"
exit 1
fi
if [[ $HAS_OVERWRITTEN_TARGET -eq 1 ]]; then
TARGET_DIR=$TARGET_SERVER_NAME
else
echo "Please specify a local directory where the server resides using -s parameter"
fi
if [ ! -d $TARGET_DIR/plugins ]; then
echo "Could not find target directory $TARGET_DIR/plugins!"
exit 1
fi
# locate old bundle
BUNDLE_COUNT=`find $TARGET_DIR/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar" | wc -l`
OLD_BUNDLE=`find $TARGET_DIR/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar"`
if [[ $OLD_BUNDLE == "" ]] || [[ $BUNDLE_COUNT -ne 1 ]]; then
echo "ERROR: Could not find any bundle named $OSGI_BUNDLE_NAME ($BUNDLE_COUNT). Perhaps your name is misspelled or you have no build?"
exit 1
fi
echo "Found $OLD_BUNDLE"
OLD_BUNDLE_BASENAME=`basename $OLD_BUNDLE .jar`
OLD_BUNDLE_VERSION=${OLD_BUNDLE_BASENAME#*_}
echo "OLD bundle is $OSGI_BUNDLE_NAME with version $OLD_BUNDLE_VERSION"
# locate new bundle
NEW_BUNDLE=`find $p2PluginRepository/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar"`
NEW_BUNDLE_BASENAME=`basename $NEW_BUNDLE .jar`
NEW_BUNDLE_VERSION=${NEW_BUNDLE_BASENAME#*_}
echo "NEW bundle is $OSGI_BUNDLE_NAME with version $NEW_BUNDLE_VERSION"
if [[ $NEW_BUNDLE_VERSION == $OLD_BUNDLE_VERSION ]]; then
echo ""
echo "WARNING: Bundle versions do not differ. Update not needed."
fi
if [ $suppress_confirmation -eq 0 ]; then
read -s -n1 -p "Do you really want to locally deploy bundle $OSGI_BUNDLE_NAME to $TARGET_DIR? (y/N): " answer
case $answer in
"Y" | "y") echo "Continuing";;
*) echo "Aborting..."
exit 1;;
esac
fi
# deploy new bundle physically
echo ""Removing $OLD_BUNDLE...
rm -f $OLD_BUNDLE
cp $NEW_BUNDLE $TARGET_DIR/plugins
echo "Copied ${NEW_BUNDLE_BASENAME}.jar to $TARGET_DIR/plugins. Please restart the server..."
exit 0
fi
if [[ "$@" == "hot-deploy" ]]; then
# check parameters
if [[ $OSGI_BUNDLE_NAME == "" ]]; then