|
8 | 8 | # to you under the Apache License, Version 2.0 (the |
9 | 9 | # "License"); you may not use this file except in compliance |
10 | 10 | # with the License. You may obtain a copy of the License at |
11 | | -# |
| 11 | +# |
12 | 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
13 | | -# |
| 13 | +# |
14 | 14 | # Unless required by applicable law or agreed to in writing, |
15 | 15 | # software distributed under the License is distributed on an |
16 | 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
@@ -45,40 +45,41 @@ jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.2.jar' |
45 | 45 | while getopts 'm:h:f:u:Ft:e:s:o:r:d:p:'# OPTION |
46 | 46 | do |
47 | 47 | case $OPTION in |
48 | | - m) mflag=1 |
49 | | - mntpoint="$OPTARG" |
50 | | - ;; |
51 | | - f) fflag=1 |
52 | | - tmpltimg="$OPTARG" |
53 | | - ;; |
54 | | - u) uflag=1 |
55 | | - url="$OPTARG" |
56 | | - ;; |
57 | | - F) Fflag=1 ;; |
| 48 | + m) mflag=1 |
| 49 | + mntpoint="$OPTARG" |
| 50 | + ;; |
| 51 | + f) fflag=1 |
| 52 | + tmpltimg="$OPTARG" |
| 53 | + ;; |
| 54 | + u) uflag=1 |
| 55 | + url="$OPTARG" |
| 56 | + ;; |
| 57 | + F) Fflag=1 |
| 58 | + ;; |
58 | 59 | t) templateId="$OPTARG" |
59 | | - ;; |
| 60 | + ;; |
60 | 61 | e) ext="$OPTARG" |
61 | | - ;; |
| 62 | + ;; |
62 | 63 | h) hyper="$OPTARG" |
63 | | - ;; |
| 64 | + ;; |
64 | 65 | s) sflag=1 |
65 | | - msKey="$OPTARG" |
66 | | - ;; |
| 66 | + msKey="$OPTARG" |
| 67 | + ;; |
67 | 68 | o) oflag=1 |
68 | 69 | dbHost="$OPTARG" |
69 | | - ;; |
| 70 | + ;; |
70 | 71 | r) rflag=1 |
71 | 72 | dbUser="$OPTARG" |
72 | | - ;; |
| 73 | + ;; |
73 | 74 | d) dflag=1 |
74 | 75 | dbPassword="$OPTARG" |
75 | | - ;; |
| 76 | + ;; |
76 | 77 | p) pflag=1 |
77 | 78 | dbPort="$OPTARG" |
78 | | - ;; |
79 | | - ?) usage |
80 | | - failed 2 |
81 | | - ;; |
| 79 | + ;; |
| 80 | + ?) usage |
| 81 | + failed 2 |
| 82 | + ;; |
82 | 83 | esac |
83 | 84 | done |
84 | 85 |
|
|
94 | 95 | failed 2 |
95 | 96 | fi |
96 | 97 |
|
97 | | -if [ ! -d $mntpoint ] |
| 98 | +if [ ! -d $mntpoint ] |
98 | 99 | then |
99 | 100 | echo "mount point $mntpoint doesn't exist\n" |
100 | 101 | failed 4 |
101 | 102 | fi |
102 | 103 |
|
103 | | -if [[ "$fflag" == "1" && ! -f $tmpltimg ]] |
| 104 | +if [[ "$fflag" == "1" && ! -f $tmpltimg ]] |
104 | 105 | then |
105 | 106 | echo "template image file $tmpltimg doesn't exist" |
106 | 107 | failed 3 |
107 | 108 | fi |
108 | 109 |
|
109 | | -if [ -f /etc/cloudstack/management/db.properties ]; then |
110 | | - if [ "$pflag" != 1 ]; then |
| 110 | +if [ -f /etc/cloudstack/management/db.properties ] |
| 111 | +then |
| 112 | + if [ "$pflag" != 1 ] |
| 113 | + then |
111 | 114 | dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') |
112 | 115 | fi |
113 | 116 |
|
114 | | - if [ "$oflag" != 1 ]; then |
| 117 | + if [ "$oflag" != 1 ] |
| 118 | + then |
115 | 119 | dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') |
116 | 120 | fi |
117 | 121 |
|
118 | | - if [ "$rflag" != 1 ]; then |
| 122 | + if [ "$rflag" != 1 ] |
| 123 | + then |
119 | 124 | dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') |
120 | 125 | fi |
121 | 126 |
|
|
186 | 191 |
|
187 | 192 | if [ ! $templateId ] |
188 | 193 | then |
189 | | - echo "Unable to get template Id from database" |
190 | | - failed 8 |
| 194 | + echo "Unable to get template Id from database" |
| 195 | + failed 8 |
191 | 196 | fi |
192 | 197 |
|
193 | 198 | _uuid=$(uuidgen) |
|
0 commit comments