OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # All scripts should die on error unless commands are specifically excepted | 6 # All scripts should die on error unless commands are specifically excepted |
7 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. | 7 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. |
8 set -e | 8 set -e |
9 # Clean up on regular or error exits. | 9 # Clean up on regular or error exits. |
10 trap clean_temp EXIT | 10 trap clean_temp EXIT |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 exit $ret | 101 exit $ret |
102 ;; | 102 ;; |
103 --sb_extract) | 103 --sb_extract) |
104 make_temp | 104 make_temp |
105 echo "The resources are extracted into: $TMP_DIR" | 105 echo "The resources are extracted into: $TMP_DIR" |
106 untar_and_chdir "$SELF" | 106 untar_and_chdir "$SELF" |
107 # Don't remove the temporary folder on exit. | 107 # Don't remove the temporary folder on exit. |
108 TMP_DIR="" | 108 TMP_DIR="" |
109 exit 0 | 109 exit 0 |
110 ;; | 110 ;; |
| 111 --force) |
| 112 force_flag=1 |
| 113 ;; |
111 -h|"-?"|--help) | 114 -h|"-?"|--help) |
112 echo "Shellball -- self-extract and install" | 115 echo "Shellball -- self-extract and install" |
113 echo "" | 116 echo "" |
114 echo "Usage: $SELF [options] [-- [inside-script-options]]" | 117 echo "Usage: $SELF [options] [-- [inside-script-options]]" |
115 echo "" | 118 echo "" |
116 echo "options:" | 119 echo "options:" |
117 echo " -h show usage help" | 120 echo " -h show usage help" |
118 echo " -V show version of containing files" | 121 echo " -V show version of containing files" |
119 echo " --sb_check check content integrity" | 122 echo " --sb_check check content integrity" |
120 echo " --sb_extract extract content to temp folder" | 123 echo " --sb_extract extract content to temp folder" |
121 echo "" | 124 echo "" |
122 echo " All other parameters will be passed to the script inside." | 125 echo " All other parameters will be passed to the script inside." |
123 echo "" | 126 echo "" |
124 echo " You can invoke as '$SELF -- -h'" | 127 echo " You can invoke as '$SELF -- -h'" |
125 echo " to see the usage and options of inside-script." | 128 echo " to see the usage and options of inside-script." |
126 echo "" | 129 echo "" |
127 exit 1 | 130 exit 1 |
128 ;; | 131 ;; |
129 --debug | --verbose | -v) | 132 --debug | --verbose | -v) |
130 # do not shift here because this needs to be passed into the script | 133 # do not shift here because this needs to be passed into the script |
131 IS_VERBOSE=1 | 134 IS_VERBOSE=1 |
132 ;; | 135 ;; |
133 --) | 136 --) |
134 shift | 137 shift |
135 ;; | 138 ;; |
136 esac | 139 esac |
137 | 140 |
| 141 # Do nothing if we're debugging BIOS changes, unless forced |
| 142 if [ -e /root/.leave_firmware_alone ] && [ -z "${force_flag:-}" ]; then |
| 143 echo "WARNING: $0 is disabled" |
| 144 exit 0 |
| 145 fi |
| 146 |
138 # Prepare execution environment | 147 # Prepare execution environment |
139 make_temp | 148 make_temp |
140 allow_temp_exec | 149 allow_temp_exec |
141 untar_and_chdir "$SELF" | 150 untar_and_chdir "$SELF" |
142 if [ ! -x $SCRIPT ]; then | 151 if [ ! -x $SCRIPT ]; then |
143 error_exit "Cannot execute $SCRIPT" | 152 error_exit "Cannot execute $SCRIPT" |
144 fi | 153 fi |
145 | 154 |
146 # Are we running in legacy mode or new flavor? | 155 # Are we running in legacy mode or new flavor? |
147 PATH=".:$PATH" | 156 PATH=".:$PATH" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 fi | 189 fi |
181 fi | 190 fi |
182 | 191 |
183 verbose_message "Run built-in script ($SCRIPT) ..." | 192 verbose_message "Run built-in script ($SCRIPT) ..." |
184 if ! $SCRIPT "$@"; then | 193 if ! $SCRIPT "$@"; then |
185 error_exit "ERROR: $SCRIPT failed." | 194 error_exit "ERROR: $SCRIPT failed." |
186 fi | 195 fi |
187 exit 0 | 196 exit 0 |
188 | 197 |
189 # Below are uuencoded blob. Don't put code behind exit 0. | 198 # Below are uuencoded blob. Don't put code behind exit 0. |
OLD | NEW |