~ibmcharmers/layer-ibm-base/trunk

« back to all changes in this revision

Viewing changes to reactive/ibm-base.sh

  • Committer: Matthew Bruzek
  • Date: 2016-03-23 20:36:38 UTC
  • Revision ID: matthew.bruzek@canonical.com-20160323203638-mtynf6b2a06fg56s
Adding readme, fixing config, layer, metadata, and ibm-base.sh 

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
      local SUM_TYPE=${SUM_STRING%%\=*}   # string before the first '='
72
72
      local SUM_VALUE=${SUM_STRING#*\=}   # string after the first '='
73
73
 
 
74
      if [ -z ${FILE_NAME} ]; then
 
75
        FILE_NAME="juju-${RANDOM}"
 
76
      fi
74
77
      curl ${CURL_OPTS} -o ${FILE_NAME} ${URL}
75
78
 
76
79
      # Verify our resource checksum. If this fails, let verify_resource log
77
80
      # the reason and exit successfully. Exiting non-zero would fail the hook,
78
81
      # so return 0 and simply inform the user that verification failed.
79
 
      verify_resource ${FILE_NAME} ${SUM_TYPE} ${SUM_STRING} || return 0
 
82
      verify_curl_resource ${FILE_NAME} ${SUM_TYPE} ${SUM_VALUE} || return 0
80
83
    done
81
84
    cd -
82
85
 
93
96
  juju-log 'Curl URL changed'
94
97
  fetch_curl_resource
95
98
}
 
99
 
96
100
@when 'ibm-base.curl.resource.fetched' 'config.changed.curl_opts'
97
101
function curl_opts_changed() {
98
102
  juju-log 'Curl options changed'
106
110
  local LIC_ACCEPTED=$(config-get 'license_accepted')
107
111
 
108
112
  # compare lowercase LIC_ACCEPTED (requires bash > 4)
109
 
  if [ "${LIC_ACCEPTED,,}" == "true"]; then
 
113
  if [ "${LIC_ACCEPTED,,}" = "true" ]; then
110
114
    set_state 'ibm-base.license.accepted'
111
115
    juju-log 'License accepted'
112
116
  else