Fix contidion and format

This commit is contained in:
Luis Guzmán 2019-07-31 02:37:12 -05:00
parent a063669e9c
commit 99da3272b0
No known key found for this signature in database
GPG Key ID: BE0F0FDD8926E0C5
1 changed files with 7 additions and 4 deletions

View File

@ -70,7 +70,7 @@ gcloud auth application-default login
GC_MEMBER=transcript GC_MEMBER=transcript
echo "Checking if project exist..." echo "Checking if project exist..."
PROJECT_GC_ID=$(gcloud projects list | grep $GC_PROJECT_NAME | awk '{print$3}') PROJECT_GC_ID=$(gcloud projects list | grep $GC_PROJECT_NAME | awk '{print$3}')
while [ ! -z $PROJECT_GC_ID ] while [ -z $PROJECT_GC_ID ]
do do
read -p "Enter the project name you just created for Jigasi Speech-to-Text"$'\n' -r GC_PROJECT_NAME read -p "Enter the project name you just created for Jigasi Speech-to-Text"$'\n' -r GC_PROJECT_NAME
if [ -z PROJECT_GC_ID ]; then if [ -z PROJECT_GC_ID ]; then
@ -92,7 +92,8 @@ do
CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)" CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)"
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
echo "Seems you haven't enabled billing for this project: $GC_PROJECT_NAME echo "Seems you haven't enabled billing for this project: $GC_PROJECT_NAME
For that go to: https://console.developers.google.com/project/$PROJECT_GC_ID/settings" For that go to: https://console.developers.google.com/project/$PROJECT_GC_ID/settings
"
read -p "Press Enter to continue" read -p "Press Enter to continue"
CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)" CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)"
fi fi
@ -127,12 +128,14 @@ cat << KEY_JSON > $GC_API_JSON
# Paste below this comment your GC JSON key for the service account: # Paste below this comment your GC JSON key for the service account:
# $GC_MEMBER@$GC_PROJECT_NAME.iam.gserviceaccount.com # $GC_MEMBER@$GC_PROJECT_NAME.iam.gserviceaccount.com
# #
# Visit the following URL and create a *Service Account Key*:
# https://console.developers.google.com/apis/credentials?folder=&organizationId=&project=$GC_PROJECT_NAME
# These comment lines will be deleted afterwards. # These comment lines will be deleted afterwards.
# #
KEY_JSON KEY_JSON
chmod 644 $GC_API_JSON chmod 644 $GC_API_JSON
nano $GC_API_JSON nano $GC_API_JSON
sed -i "1,6d" $GC_API_JSON sed -i '/^#/d' $GC_API_JSON
CHECK_JSON_KEY="$(cat $GC_API_JSON | python -m json.tool 2>/dev/null)" CHECK_JSON_KEY="$(cat $GC_API_JSON | python -m json.tool 2>/dev/null)"
while [[ $? -eq 1 ]] while [[ $? -eq 1 ]]
@ -152,7 +155,7 @@ sleep 2
export GOOGLE_APPLICATION_CREDENTIALS=$GC_API_JSON export GOOGLE_APPLICATION_CREDENTIALS=$GC_API_JSON
echo "Installing Jigasi, your SIP credentials will be asked. (skip)" echo "Installing Jigasi, your SIP credentials will be asked. (mandatory)"
apt -y install jigasi apt -y install jigasi