From: gyeongseok.seo Date: Fri, 20 Jul 2012 08:58:09 +0000 (+0900) Subject: [Title] Added total command script X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2301721bbce6279932277fed35e5d8a5c0c8144;p=sdk%2Ftools%2Fcli.git [Title] Added total command script [Type] Enhancement [Module] cli [Priority] Major [Jira#] [Redmine#] 5831 [Problem] [Cause] [Solution] [TestCase] cli Change-Id: I26fabbb2fcd80e9d5ae35aa4f1ed02cf36b0f924 --- diff --git a/org.tizen.cli/doc/install/bin_/webtizen b/org.tizen.cli/doc/install/bin_/webtizen new file mode 100644 index 0000000..e03fc6d --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/webtizen @@ -0,0 +1,164 @@ +#!/bin/sh + +#variable +SCRIPT="$0" +MAIN= +CMD= + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +#method +_print_usage() +{ + echo "Usage: $SCRIPT [options] [suboption]" + echo " -h : Display this usage information." + echo " -p : Packaging widget project" + echo " -s : Signing widget project" + echo " ---------------------------------------------------------" + echo " Singing [suboption]" + echo " -e,--exclude file name pattern to exclude" + echo " -h,--help print out this page" + echo " -i,--include file name pattern to include" + echo " -l,--log specify log level( ex - error, warn, info, debug,trace, none )" + echo " -n,--nocheck skip validation check" + echo " -p,--profile specify profile name with or without profile file(example - test, test:/opt/profile.xml )" + echo " -q,--quiet execute silently" + echo " ---------------------------------------------------------" + + echo " -l : Display installed widgets handle and name list" + echo " -i : Install widget package for target" + echo " -u : Install widget package for target" + echo " -r : Install wdiget package for target And Launch widget" + echo " -d : Install wdiget package for target And Launch widget And activate debug mode" + + exit $1 +} + +_check_zero_option() +{ + echo "_check_zero_option()" + if [ "0" = $# ] + then + _print_usage 1 + fi +} + +_select_option() +{ + echo "select_option : $1" + #while getopts hp:l:i:r:d: OPTIONS + #do + case "$1" in + -h) + _print_usage 0 + ;; + -p) + MAIN=org.tizen.cli.exec.wgt.Main + SCRIPT="web-packaging" +# CMD="$OPTARG" + ;; + -s) + MAIN=org.tizen.cli.exec.sign.Main + SCRIPT="web-signing" +# CMD="$OPTARG" + ;; + -l) + MAIN=org.tizen.cli.exec.query.Main + SCRIPT="web-query" +# CMD="$OPTARG" + ;; + -i) + MAIN=org.tizen.cli.exec.install.Main + SCRIPT="web-install" +# CMD="$OPTARG" + ;; + -u) + MAIN=org.tizen.cli.exec.uninstall.Main + SCRIPT="web-uninstall" +# CMD="$OPTARG" + ;; + -r) + MAIN=org.tizen.cli.exec.run.Main + SCRIPT="web-run" +# CMD="$OPTARG" + ;; + -d) + MAIN=org.tizen.cli.exec.debug.Main + SCRIPT="web-debug" +# CMD="$OPTARG" + ;; + ?) + _print_usage 1 + ;; + esac + #done + #shift 1 + echo "remain option : $@" +} + +_run_command() +{ + echo "_run_command() : $SCRIPT" + while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi + done + + for WORD in $@; do + echo "WORD is $WORD" + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac + done + + OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + + EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + + if [ -n "$OPT_TRACE" ] + then + echo "Command :$EXEC" + fi + $EXEC +} + +#script execute +_check_zero_option $@ +_select_option $@ +shift 1 +_run_command $@