1 #!/bin/bash 2 3 #==================================================================================================== 4 # 5 # Script Name: generateDBProv 6 # 7 # General Description: Generate Provisioning Database wizard. 8 # 9 #==================================================================================================== 10 # 11 # Copyright (C) 2014 The Android Open Source Project 12 # 13 # Licensed under the Apache License, Version 2.0 (the "License"); 14 # you may not use this file except in compliance with the License. 15 # You may obtain a copy of the License at 16 # 17 # http://www.apache.org/licenses/LICENSE-2.0 18 # 19 # Unless required by applicable law or agreed to in writing, software 20 # distributed under the License is distributed on an "AS IS" BASIS, 21 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 # See the License for the specific language governing permissions and 23 # limitations under the License. 24 # 25 #==================================================================================================== 26 27 usage () { 28 echo "" 29 echo "=========================================================================================" 30 echo "" 31 echo " This tool accepts sources in the .csv or .txt formats. These two formats" 32 echo " cannot be mixed together. At least one source file is required." 33 echo "" 34 echo " Usage of the version: " 35 echo "" 36 echo " generateDBProv [-mms <path>/mms.csv]" 37 echo " [-browser <path>/browser.csv]" 38 echo " [-java <path>/java.csv]" 39 echo " [-im <path>/im.csv]" 40 echo " [-debug]" 41 echo " [-nozip]" 42 echo "" 43 echo " -- or --" 44 echo "" 45 echo " generateDBProv [-mms <path>/mms.txt]" 46 echo " [-browser <path>/browser.txt]" 47 echo " [-java <path>/java.txt]" 48 echo " [-im <path>/im.txt]" 49 echo " [-debug]" 50 echo " [-nozip]" 51 echo "" 52 echo " Where options are including:" 53 echo "" 54 echo " -mms <path>/mms.* - path to the file with settings for the MMS" 55 echo " -browser <path>/browser.* - path to the file with settings for the Browser" 56 echo " -java <path>/java .* - path to the file with settings for the Java" 57 echo " -im <path>/im.* - path to the file with settings for the IM" 58 echo " -debug - do not remove temporary .xml, .wbxml and .zip files" 59 echo " -nozip - do not zip wbxml settings" 60 echo "" 61 echo "" 62 echo " For dumping DB: " 63 echo "" 64 echo " generateDBProv -dump <path>/lj_dmwizard.dat" 65 echo "" 66 echo "==========================================================================================" 67 echo "" 68 } 69 70 export LANG=en_US 71 export LANGVAR=en_US 72 unset LC_ALL 73 export LC_CTYPE="en_US.UTF-8" 74 75 if [ -z "$JAVA_HOME" ] 76 then 77 echo "Error: Environment variable JAVA_HOME must be set to jdk 1.4 and latest!" 78 exit 1 79 fi 80 81 JAVA_VERSION=`$JAVA_HOME/bin/java -version 2> /dev/stdout | grep ver | sed -e 's/.*\"\([1-9]\.[0-9][0-9]*\)\..*/\1/'` 82 if [ "$JAVA_VERSION" \< "1.4" ] 83 then 84 echo "Error: Java vesion is not correct" 85 echo "The tool supports java version from 1.4 and latest" 86 echo "Please set environment variable JAVA_HOME to the correct java version" 87 exit 1 88 fi 89 90 # validate parameters 91 if [ "$#" -eq 0 ] 92 then 93 echo "" 94 echo "Error! Required parameters are missing!!!" 95 echo "Use flag --help for the help" 96 echo "" 97 exit 1 98 fi 99 100 PARMS="" 101 102 while [ $# -gt 0 ]; do 103 case "$1" in 104 --help ) usage 105 exit 1 106 shift ;; 107 * ) PARMS="$PARMS $1" 108 shift ;; 109 esac 110 done 111 112 $JAVA_HOME/bin/java -classpath lib/DBProvTool.jar com.mot.dm.dbtool.Generator $PARMS 113 114 115