├── Makefile ├── README.md ├── Dockerfile ├── daemonset.yaml ├── entrypoint.sh └── LICENSE /Makefile: -------------------------------------------------------------------------------- 1 | TAG?=latest 2 | REGISTRY?=shelmangroup 3 | IMAGE=coreos-nvidia-driver-installer 4 | 5 | container: 6 | docker build --pull -t ${REGISTRY}/${IMAGE}:${TAG} . 7 | 8 | push: 9 | docker push ${REGISTRY}/${IMAGE}:${TAG} 10 | 11 | .PHONY: container push 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # coreos-gpu-installer 2 | This repository contains scripts to build Docker containers that can be used to download, compile and install Nvidia GPU drivers on CoreOS Container Linux OS images. 3 | 4 | ## How to use 5 | 6 | Example command: 7 | ``` shell 8 | kubectl create -f daemonset.yaml 9 | ``` 10 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | FROM ubuntu:18.10 14 | 15 | RUN apt-get update && \ 16 | apt-get install -y \ 17 | bc \ 18 | bison \ 19 | curl \ 20 | flex \ 21 | gcc \ 22 | kmod \ 23 | libelf-dev \ 24 | libssl-dev \ 25 | make \ 26 | perl-modules \ 27 | xz-utils \ 28 | && \ 29 | rm -rf /var/lib/apt/lists/* 30 | 31 | COPY entrypoint.sh /entrypoint.sh 32 | 33 | CMD /entrypoint.sh 34 | -------------------------------------------------------------------------------- /daemonset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: DaemonSet 3 | metadata: 4 | name: nvidia-driver-installer 5 | namespace: kube-system 6 | spec: 7 | template: 8 | metadata: 9 | labels: 10 | name: nvidia-driver-installer 11 | spec: 12 | tolerations: 13 | - key: "nvidia.com/gpu" 14 | effect: "NoSchedule" 15 | operator: "Exists" 16 | hostNetwork: true 17 | hostPID: true 18 | volumes: 19 | - name: dev 20 | hostPath: 21 | path: /dev 22 | - name: nvidia-install-dir-host 23 | hostPath: 24 | path: /opt/nvidia 25 | - name: root-mount 26 | hostPath: 27 | path: / 28 | initContainers: 29 | - image: shelmangroup/coreos-nvidia-driver-installer:latest 30 | name: nvidia-driver-installer 31 | resources: 32 | requests: 33 | cpu: 0.15 34 | securityContext: 35 | privileged: true 36 | env: 37 | - name: NVIDIA_INSTALL_DIR_HOST 38 | value: /opt/nvidia 39 | - name: NVIDIA_INSTALL_DIR_CONTAINER 40 | value: /usr/local/nvidia 41 | - name: ROOT_MOUNT_DIR 42 | value: /root 43 | volumeMounts: 44 | - name: nvidia-install-dir-host 45 | mountPath: /usr/local/nvidia 46 | - name: dev 47 | mountPath: /dev 48 | - name: root-mount 49 | mountPath: /root 50 | containers: 51 | - image: "gcr.io/google-containers/pause:2.0" 52 | name: pause 53 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | set -o errexit 16 | set -o pipefail 17 | set -u 18 | 19 | set -x 20 | 21 | KERNEL_SRC_URL="https://cdn.kernel.org/pub/linux/kernel/v4.x" 22 | KERNEL_SRC_ARCHIVE="linux-$(uname -r | cut -d- -f1).tar.xz" 23 | KERNEL_SRC_DIR="${KERNEL_SRC_DIR:-/build/usr/src/linux}" 24 | ROOT_OS_RELEASE="${ROOT_OS_RELEASE:-/root/etc/os-release}" 25 | NVIDIA_DRIVER_VERSION="${NVIDIA_DRIVER_VERSION:-410.78}" 26 | NVIDIA_DRIVER_DOWNLOAD_URL_DEFAULT="https://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_DRIVER_VERSION}/NVIDIA-Linux-x86_64-${NVIDIA_DRIVER_VERSION}.run" 27 | NVIDIA_DRIVER_DOWNLOAD_URL="${NVIDIA_DRIVER_DOWNLOAD_URL:-$NVIDIA_DRIVER_DOWNLOAD_URL_DEFAULT}" 28 | NVIDIA_INSTALL_DIR_HOST="${NVIDIA_INSTALL_DIR_HOST:-/opt/nvidia}" 29 | NVIDIA_INSTALL_DIR_CONTAINER="${NVIDIA_INSTALL_DIR_CONTAINER:-/usr/local/nvidia}" 30 | NVIDIA_INSTALLER_RUNFILE="$(basename "${NVIDIA_DRIVER_DOWNLOAD_URL}")" 31 | ROOT_MOUNT_DIR="${ROOT_MOUNT_DIR:-/root}" 32 | CACHE_FILE="${NVIDIA_INSTALL_DIR_CONTAINER}/.cache" 33 | set +x 34 | 35 | RETCODE_SUCCESS=0 36 | RETCODE_ERROR=1 37 | RETRY_COUNT=5 38 | 39 | _log() { 40 | local -r prefix="$1" 41 | shift 42 | echo "[${prefix}$(date -u "+%Y-%m-%d %H:%M:%S %Z")] ""$*" >&2 43 | } 44 | 45 | info() { 46 | _log "INFO " "$*" 47 | } 48 | 49 | warn() { 50 | _log "WARNING " "$*" 51 | } 52 | 53 | error() { 54 | _log "ERROR " "$*" 55 | } 56 | 57 | load_etc_os_release() { 58 | if [[ ! -f "${ROOT_OS_RELEASE}" ]]; then 59 | error "File ${ROOT_OS_RELEASE} not found, /etc/os-release from Container Linux host must be mounted." 60 | exit ${RETCODE_ERROR} 61 | fi 62 | . "${ROOT_OS_RELEASE}" 63 | info "Running on Container Linux version id ${VERSION_ID}" 64 | } 65 | 66 | unload_modules() { 67 | info "Unloading existing kernel module drivers" 68 | for module in nvidia_uvm nvidia_drm nvidia; do 69 | if grep -q -w ${module} /proc/modules; then 70 | rmmod ${module} || exit ${RETCODE_ERROR} 71 | info "Successfully unloaded ${module}" 72 | fi 73 | done 74 | } 75 | 76 | check_cached_version() { 77 | info "Checking cached version" 78 | if [[ ! -f "${CACHE_FILE}" ]]; then 79 | info "Cache file ${CACHE_FILE} not found." 80 | return ${RETCODE_ERROR} 81 | fi 82 | 83 | # Source the cache file and check if the cached driver matches 84 | # currently running image build and driver versions. 85 | . "${CACHE_FILE}" 86 | if [[ "${VERSION_ID}" == "${CACHE_VERSION_ID}" ]]; then 87 | if [[ "${NVIDIA_DRIVER_VERSION}" == \ 88 | "${CACHE_NVIDIA_DRIVER_VERSION}" ]]; then 89 | info "Found existing driver installation for image version ${BUILD_ID} \ 90 | and driver version ${NVIDIA_DRIVER_VERSION}." 91 | return ${RETCODE_SUCCESS} 92 | fi 93 | fi 94 | if [[ -d "${ROOT_MOUNT_DIR}${NVIDIA_INSTALL_DIR_HOST}" ]]; then 95 | unload_modules 96 | info "Removing existing driver installation from ${ROOT_MOUNT_DIR}${NVIDIA_INSTALL_DIR_HOST}" 97 | rm -rf "${ROOT_MOUNT_DIR}${NVIDIA_INSTALL_DIR_HOST}" 98 | fi 99 | return ${RETCODE_ERROR} 100 | } 101 | 102 | update_cached_version() { 103 | cat >"${CACHE_FILE}"<<__EOF__ 104 | CACHE_VERSION_ID=${VERSION_ID} 105 | CACHE_NVIDIA_DRIVER_VERSION=${NVIDIA_DRIVER_VERSION} 106 | __EOF__ 107 | 108 | info "Updated cached version as:" 109 | cat "${CACHE_FILE}" 110 | } 111 | 112 | update_container_ld_cache() { 113 | info "Updating container's ld cache" 114 | echo "${NVIDIA_INSTALL_DIR_CONTAINER}/lib64" > /etc/ld.so.conf.d/nvidia.conf 115 | ldconfig 116 | } 117 | 118 | download_kernel_src_archive() { 119 | local -r download_url="$1" 120 | info "Kernel source archive download URL: ${download_url}" 121 | mkdir -p "${KERNEL_SRC_DIR}" 122 | pushd "${KERNEL_SRC_DIR}" 123 | local attempts=0 124 | until time curl -sfS "${download_url}" -o "${KERNEL_SRC_ARCHIVE}"; do 125 | attempts=$(( ${attempts} + 1 )) 126 | if (( "${attempts}" >= "${RETRY_COUNT}" )); then 127 | error "Could not download kernel sources from ${download_url}, giving up." 128 | return ${RETCODE_ERROR} 129 | fi 130 | warn "Error fetching kernel source archive from ${download_url}, retrying" 131 | sleep 1 132 | done 133 | popd 134 | } 135 | 136 | download_kernel_src_from_git_repo() { 137 | # KERNEL_COMMIT_ID comes from /root/etc/os-release file. 138 | local -r download_url="${KERNEL_SRC_URL}/${KERNEL_SRC_ARCHIVE}" 139 | download_kernel_src_archive "${download_url}" 140 | } 141 | 142 | download_kernel_src() { 143 | if [[ -z "$(ls -A "${KERNEL_SRC_DIR}")" ]]; then 144 | info "Kernel sources not found locally, downloading" 145 | mkdir -p "${KERNEL_SRC_DIR}" 146 | if ! download_kernel_src_from_git_repo; then 147 | return ${RETCODE_ERROR} 148 | fi 149 | fi 150 | pushd "${KERNEL_SRC_DIR}" 151 | tar xf "${KERNEL_SRC_ARCHIVE}" --strip-components=1 152 | popd 153 | } 154 | 155 | configure_kernel_src() { 156 | info "Configuring kernel sources" 157 | pushd "${KERNEL_SRC_DIR}" 158 | zcat /proc/config.gz > .config 159 | make olddefconfig 160 | make modules_prepare 161 | 162 | # TODO: Figure out why the kernel magic version hack is required. 163 | local kernel_version_uname="$(uname -r)" 164 | local kernel_version_src="$(cat include/generated/utsrelease.h | awk '{ print $3 }' | tr -d '"')" 165 | if [[ "${kernel_version_uname}" != "${kernel_version_src}" ]]; then 166 | info "Modifying kernel version magic string in source files" 167 | sed -i "s|${kernel_version_src}|${kernel_version_uname}|g" "include/generated/utsrelease.h" 168 | fi 169 | popd 170 | } 171 | 172 | configure_nvidia_installation_dirs() { 173 | info "Configuring installation directories" 174 | mkdir -p "${NVIDIA_INSTALL_DIR_CONTAINER}" 175 | pushd "${NVIDIA_INSTALL_DIR_CONTAINER}" 176 | 177 | # nvidia-installer does not provide an option to configure the 178 | # installation path of `nvidia-modprobe` utility and always installs it 179 | # under /usr/bin. The following workaround ensures that 180 | # `nvidia-modprobe` is accessible outside the installer container 181 | # filesystem. 182 | mkdir -p bin bin-workdir 183 | mount -t overlay -o lowerdir=/usr/bin,upperdir=bin,workdir=bin-workdir none /usr/bin 184 | 185 | # nvidia-installer does not provide an option to configure the 186 | # installation path of libraries such as libnvidia-ml.so. The following 187 | # workaround ensures that the libs are accessible from outside the 188 | # installer container filesystem. 189 | mkdir -p lib64 lib64-workdir 190 | mkdir -p /usr/lib/x86_64-linux-gnu 191 | mount -t overlay -o lowerdir=/usr/lib/x86_64-linux-gnu,upperdir=lib64,workdir=lib64-workdir none /usr/lib/x86_64-linux-gnu 192 | 193 | # nvidia-installer does not provide an option to configure the 194 | # installation path of driver kernel modules such as nvidia.ko. The following 195 | # workaround ensures that the modules are accessible from outside the 196 | # installer container filesystem. 197 | mkdir -p drivers drivers-workdir 198 | mkdir -p /lib/modules/"$(uname -r)"/video 199 | mount -t overlay -o lowerdir=/lib/modules/"$(uname -r)"/video,upperdir=drivers,workdir=drivers-workdir none /lib/modules/"$(uname -r)"/video 200 | 201 | # Populate ld.so.conf to avoid warning messages in nvidia-installer logs. 202 | update_container_ld_cache 203 | 204 | # Install an exit handler to cleanup the overlayfs mount points. 205 | trap "{ umount /lib/modules/\"$(uname -r)\"/video; umount /usr/lib/x86_64-linux-gnu ; umount /usr/bin; }" EXIT 206 | popd 207 | } 208 | 209 | download_nvidia_installer() { 210 | info "Downloading NVIDIA installer ... " 211 | pushd "${NVIDIA_INSTALL_DIR_CONTAINER}" 212 | curl -L -sS "${NVIDIA_DRIVER_DOWNLOAD_URL}" -o "${NVIDIA_INSTALLER_RUNFILE}" 213 | popd 214 | } 215 | 216 | run_nvidia_installer() { 217 | info "Running NVIDIA installer" 218 | # Load deps 219 | if ! grep -q -w ipmi_msghandler /proc/modules; then 220 | insmod `find /root/lib/modules -iname ipmi_msghandler.ko` 221 | fi 222 | if ! grep -q -w ipmi_devintf /proc/modules; then 223 | insmod `find /root/lib/modules -iname ipmi_devintf.ko` 224 | fi 225 | pushd "${NVIDIA_INSTALL_DIR_CONTAINER}" 226 | IGNORE_MISSING_MODULE_SYMVERS=1 \ 227 | sh "${NVIDIA_INSTALLER_RUNFILE}" \ 228 | --kernel-source-path="${KERNEL_SRC_DIR}" \ 229 | --no-drm \ 230 | --no-opengl-files \ 231 | --silent 232 | popd 233 | } 234 | 235 | configure_cached_installation() { 236 | info "Configuring cached driver installation" 237 | update_container_ld_cache 238 | if ! grep -q -w nvidia /proc/modules; then 239 | insmod "${NVIDIA_INSTALL_DIR_CONTAINER}/drivers/nvidia.ko" 240 | fi 241 | if ! grep -q -w nvidia_uvm /proc/modules; then 242 | insmod "${NVIDIA_INSTALL_DIR_CONTAINER}/drivers/nvidia-uvm.ko" 243 | fi 244 | if ! grep -q -w nvidia_drm /proc/modules; then 245 | insmod "${NVIDIA_INSTALL_DIR_CONTAINER}/drivers/nvidia-drm.ko" 246 | fi 247 | } 248 | 249 | verify_nvidia_installation() { 250 | info "Verifying NVIDIA installation" 251 | export PATH="${NVIDIA_INSTALL_DIR_CONTAINER}/bin:${PATH}" 252 | nvidia-smi 253 | # Create unified memory device file. 254 | nvidia-modprobe -c0 -u 255 | 256 | # TODO: Add support for enabling persistence mode. 257 | } 258 | 259 | update_host_ld_cache() { 260 | info "Updating host's ld cache" 261 | mkdir -p ${ROOT_MOUNT_DIR}/etc/ld.so.conf.d 262 | echo "${NVIDIA_INSTALL_DIR_HOST}/lib64" > "${ROOT_MOUNT_DIR}/etc/ld.so.conf.d/nvidia.conf" 263 | ldconfig -r "${ROOT_MOUNT_DIR}" 264 | } 265 | 266 | main() { 267 | load_etc_os_release 268 | if check_cached_version; then 269 | configure_cached_installation 270 | verify_nvidia_installation 271 | info "Found cached version, NOT building the drivers." 272 | else 273 | info "Did not find cached version, building the drivers..." 274 | download_kernel_src 275 | configure_nvidia_installation_dirs 276 | download_nvidia_installer 277 | configure_kernel_src 278 | run_nvidia_installer 279 | update_cached_version 280 | verify_nvidia_installation 281 | info "Finished installing the drivers." 282 | fi 283 | update_host_ld_cache 284 | } 285 | 286 | main "$@" 287 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------