| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 source `dirname "$0"`/memento_updater_logging.sh | 7 source `dirname "$0"`/memento_updater_logging.sh |
| 8 . /usr/lib/shflags || exit 1 |
| 9 |
| 10 DEFINE_string app_version "" \ |
| 11 "Force a given app version rather than autodetect" |
| 12 DEFINE_string track "" \ |
| 13 "Force a given track rather than autodetect" |
| 14 |
| 15 # Parse command line |
| 16 FLAGS "$@" || exit 1 |
| 17 eval set -- "${FLAGS_ARGV}" |
| 18 |
| 8 OVERRIDE_IS_SECURE="YES" | 19 OVERRIDE_IS_SECURE="YES" |
| 9 | 20 |
| 10 # Return the value for a given key in the override lsb-release file if the | 21 # Return the value for a given key in the override lsb-release file if the |
| 11 # file is secure. If no value is found, checks in the standard lsb-release | 22 # file is secure. If no value is found, checks in the standard lsb-release |
| 12 # file. | 23 # file. |
| 13 findLSBValue() | 24 findLSBValue() |
| 14 { | 25 { |
| 15 # we only check in user lsb-release file if file is passed with all security | 26 # we only check in user lsb-release file if file is passed with all security |
| 16 # check | 27 # check |
| 17 if [ "$OVERRIDE_IS_SECURE" = "YES" ] | 28 if [ "$OVERRIDE_IS_SECURE" = "YES" ] |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 127 |
| 117 LOCAL_VERSION=$(findLSBValue "CHROMEOS_RELEASE_VERSION") | 128 LOCAL_VERSION=$(findLSBValue "CHROMEOS_RELEASE_VERSION") |
| 118 | 129 |
| 119 # Parameters of the update request: | 130 # Parameters of the update request: |
| 120 OS=Memento | 131 OS=Memento |
| 121 PLATFORM=memento | 132 PLATFORM=memento |
| 122 APP_ID={87efface-864d-49a5-9bb3-4b050a7c227a} | 133 APP_ID={87efface-864d-49a5-9bb3-4b050a7c227a} |
| 123 APP_VERSION=${1:-$LOCAL_VERSION} | 134 APP_VERSION=${1:-$LOCAL_VERSION} |
| 124 APP_BOARD="$2" | 135 APP_BOARD="$2" |
| 125 OS_VERSION=${APP_VERSION}_$(uname -m) | 136 OS_VERSION=${APP_VERSION}_$(uname -m) |
| 126 PING_APP_VERSION="$APP_VERSION" | 137 PING_APP_VERSION="${FLAGS_app_version:-${APP_VERSION}}" |
| 127 if [ ! -z "$1" ]; then | |
| 128 PING_APP_VERSION="$1" | |
| 129 fi | |
| 130 LANG=en-us | 138 LANG=en-us |
| 131 BRAND=GGLG | 139 BRAND=GGLG |
| 132 | 140 |
| 133 OMAHA_ID_FILE=/mnt/stateful_partition/etc/omaha_id | 141 OMAHA_ID_FILE=/mnt/stateful_partition/etc/omaha_id |
| 134 if [ ! -f "$OMAHA_ID_FILE" ] | 142 if [ ! -f "$OMAHA_ID_FILE" ] |
| 135 then | 143 then |
| 136 # omaha file isn't a regular file | 144 # omaha file isn't a regular file |
| 137 if [ -e "$OMAHA_ID_FILE" ] | 145 if [ -e "$OMAHA_ID_FILE" ] |
| 138 then | 146 then |
| 139 # but the omaha file does exist. delete it | 147 # but the omaha file does exist. delete it |
| (...skipping 11 matching lines...) Expand all Loading... |
| 151 if [ "x" = "x$MACHINE_ID" ] | 159 if [ "x" = "x$MACHINE_ID" ] |
| 152 then | 160 then |
| 153 log missing Omaha ID and unable to generate one | 161 log missing Omaha ID and unable to generate one |
| 154 exit 1 | 162 exit 1 |
| 155 fi | 163 fi |
| 156 | 164 |
| 157 USER_ID=$MACHINE_ID | 165 USER_ID=$MACHINE_ID |
| 158 | 166 |
| 159 AU_VERSION=MementoSoftwareUpdate-0.1.0.0 | 167 AU_VERSION=MementoSoftwareUpdate-0.1.0.0 |
| 160 | 168 |
| 161 APP_TRACK=$(findLSBValue "CHROMEOS_RELEASE_TRACK") | 169 |
| 170 APP_TRACK=${FLAGS_track:-$(findLSBValue "CHROMEOS_RELEASE_TRACK")} |
| 162 | 171 |
| 163 APP_BOARD=$(findLSBValue "CHROMEOS_RELEASE_BOARD") | 172 APP_BOARD=$(findLSBValue "CHROMEOS_RELEASE_BOARD") |
| 164 | 173 |
| 165 AUSERVER_URL=$(findLSBValue "CHROMEOS_AUSERVER") | 174 AUSERVER_URL=$(findLSBValue "CHROMEOS_AUSERVER") |
| 166 | 175 |
| 167 if [ -z "$AUSERVER_URL" ] | 176 if [ -z "$AUSERVER_URL" ] |
| 168 then | 177 then |
| 169 # trying default omaha path | 178 # trying default omaha path |
| 170 AUSERVER_URL="https://tools.google.com/service/update2" | 179 AUSERVER_URL="https://tools.google.com/service/update2" |
| 171 log using default update server | 180 log using default update server |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 fi | 259 fi |
| 251 fi | 260 fi |
| 252 fi | 261 fi |
| 253 | 262 |
| 254 echo URL=$CODEBASE | 263 echo URL=$CODEBASE |
| 255 echo HASH=$HASH | 264 echo HASH=$HASH |
| 256 echo SIZE=$SIZE | 265 echo SIZE=$SIZE |
| 257 echo APP_VERSION=$APP_VERSION | 266 echo APP_VERSION=$APP_VERSION |
| 258 echo NEW_VERSION=TODO | 267 echo NEW_VERSION=TODO |
| 259 | 268 |
| OLD | NEW |