├── .gitignore ├── .gitmodules ├── .travis.yml ├── exclude.txt ├── images ├── customize.couchbase ├── customize.mongodb ├── customize.nginx ├── customize.postgresql ├── customize.percona └── customize.nodejs ├── README.md ├── create-manifest ├── create-lx-image ├── install └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | *.json 3 | *.zfs.gz 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "guesttools"] 2 | path = guesttools 3 | url = https://github.com/joyent/sdc-vmtools-lx-brand.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | addons: 3 | apt: 4 | sources: 5 | - debian-sid # Grab ShellCheck from the Debian repo 6 | packages: 7 | - shellcheck 8 | script: shellcheck -e SC2086 -s bash create-lx-image create-manifest install 9 | -------------------------------------------------------------------------------- /exclude.txt: -------------------------------------------------------------------------------- 1 | boot/* 2 | dev/* 3 | etc/ssh/ssh_host_* 4 | etc/udev/rules.d/70-persistent-net.rules 5 | initrd.img 6 | proc/* 7 | root/.bash_history 8 | root/.ssh/* 9 | sys/* 10 | tmp/* 11 | var/lock/subsys/local* 12 | var/log/*.log 13 | var/log/*/*.log 14 | var/run/* 15 | var/tmp/* 16 | vmlinuz 17 | -------------------------------------------------------------------------------- /images/customize.couchbase: -------------------------------------------------------------------------------- 1 | echo "==> Installing custom packages." 2 | wget http://packages.couchbase.com/releases/4.0.0/couchbase-server-community_4.0.0-ubuntu14.04_amd64.deb -O $INSTALL_DIR/root/couchbase-server.deb 3 | chroot $INSTALL_DIR apt-get -y update 4 | chroot $INSTALL_DIR apt-get -y upgrade 5 | -------------------------------------------------------------------------------- /images/customize.mongodb: -------------------------------------------------------------------------------- 1 | echo "==> Updating $INSTALL_DIR/etc/apt/sources.list" 2 | chroot $INSTALL_DIR apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 3 | echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee $INSTALL_DIR/etc/apt/sources.list.d/mongodb-org-3.4.list 4 | 5 | echo "==> Installing custom packages." 6 | chroot $INSTALL_DIR apt-get -y update 7 | chroot $INSTALL_DIR apt-get -y upgrade 8 | chroot $INSTALL_DIR apt-get -y --force-yes install mongodb-org 9 | -------------------------------------------------------------------------------- /images/customize.nginx: -------------------------------------------------------------------------------- 1 | echo "==> Updating $INSTALL_DIR/etc/apt/sources.list" 2 | curl -s https://nginx.org/keys/nginx_signing.key -o $INSTALL_DIR/root/nginx_signing.key 3 | chroot $INSTALL_DIR apt-key add /root/nginx_signing.key 4 | cat << SOURCES >> $INSTALL_DIR/etc/apt/sources.list 5 | deb http://nginx.org/packages/ubuntu/ trusty nginx 6 | deb-src http://nginx.org/packages/ubuntu/ trusty nginx 7 | SOURCES 8 | rm $INSTALL_DIR/root/nginx_signing.key 9 | 10 | echo "==> Installing custom packages." 11 | chroot $INSTALL_DIR apt-get -y update 12 | chroot $INSTALL_DIR apt-get -y install nginx 13 | chroot $INSTALL_DIR apt-get -y install php5-fpm 14 | -------------------------------------------------------------------------------- /images/customize.postgresql: -------------------------------------------------------------------------------- 1 | echo "==> Updating $INSTALL_DIR/etc/apt/sources.list" 2 | curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc -o $INSTALL_DIR/root/postgresql_signing.key 3 | chroot $INSTALL_DIR apt-key add /root/postgresql_signing.key 4 | cat << SOURCES >> $INSTALL_DIR/etc/apt/sources.list 5 | deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.6 6 | SOURCES 7 | rm $INSTALL_DIR/root/postgresql_signing.key 8 | 9 | chroot $INSTALL_DIR apt-get -y update 10 | chroot $INSTALL_DIR apt-get -y upgrade 11 | 12 | echo "==> Installing custom packages." 13 | sudo pkill -9 postgres 14 | chroot $INSTALL_DIR apt-get -y --force-yes install postgresql-9.6 15 | -------------------------------------------------------------------------------- /images/customize.percona: -------------------------------------------------------------------------------- 1 | echo "==> Updating $INSTALL_DIR/etc/apt/sources.list" 2 | 3 | echo "==> Installing custom packages." 4 | pkill -9 mysql 5 | curl -sS -o $INSTALL_DIR/trusty_all.deb https://repo.percona.com/apt/percona-release_0.1-4.trusty_all.deb 6 | chroot $INSTALL_DIR dpkg -i trusty_all.deb 7 | chroot $INSTALL_DIR apt-get -y update 8 | chroot $INSTALL_DIR apt-get -y upgrade 9 | DEBIAN_FRONTEND=noninteractive chroot $INSTALL_DIR apt-get -q -y install percona-server-server-5.7 10 | chroot $INSTALL_DIR mv /etc/rc2.d/S19mysql /etc/rc2.d/K19mysql 11 | chroot $INSTALL_DIR rm /etc/mysql/debian.cnf 12 | chroot $INSTALL_DIR ln -s /etc/mysql/my.cnf /etc/mysql/debian.cnf 13 | rm $INSTALL_DIR/trusty_all.deb 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu lx-brand Image Builder 2 | 3 | This is a collection of scripts used for creating an lx-brand Ubuntu image. 4 | 5 | ## Requirements 6 | 7 | In order to use these scripts you'll need: 8 | 9 | - Ubuntu (or Debian) running in a VM or bare metal (required for the `install` script) 10 | - debootstrap: `apt-get install -y debootstrap` 11 | - git: `apt-get install -y git` 12 | - A SmartOS (or SDC headnode) install (required for the `create-lx-image` script) 13 | 14 | **Note***: The build scripts currently assume you are running under a KVM ubuntu-certified instance that has a secondary disk mounted to `/mnt`. The scripts have not been tested on an lx-brand instance. 15 | 16 | 17 | ## Usage 18 | 19 | 1. Run `./install -d -m -i -p -u ` under Ubuntu to install Ubuntu 14.04 in a given directory. This will create a tarball of the installation in your working directory (named `-.tar.gz`). See `./install -h` for detailed usage. 20 | 2. Copy the tarball to a SmartOS machine or SDC headnode and run `./create-lx-image -t -i -d -u ` (substituting the name of your tar file). This will create the image file and manifest. See `/create-lx-image -h` for detailed usage. 21 | -------------------------------------------------------------------------------- /images/customize.nodejs: -------------------------------------------------------------------------------- 1 | set -euo pipefail 2 | IFS=$'\n\t' 3 | 4 | usage() { 5 | cat < 11 | 12 | Example: 13 | $0 4.4.0 14 | EOF 15 | } 16 | 17 | # We only expect one argument 18 | if [[ $# -ne 1 ]]; then 19 | usage 20 | exit 1 21 | fi 22 | 23 | NODE_VERSION=$1 24 | 25 | echo "==> Adding gpg keys from https://github.com/nodejs/node" 26 | 27 | for key in \ 28 | 9554F04D7259F04124DE6B476D5A82AC7E37093B \ 29 | 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ 30 | FD3A5288F042B6850C66B31F09FE44734EB7990E \ 31 | 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ 32 | DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ 33 | B9AE9905FFD7803F25714661B63B535A4C206CA9 \ 34 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 35 | 56730D5401028683275BD23C23EFEFE93C4CFFFE \ 36 | ; do \ 37 | gpg --list-keys "$key" || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ 38 | done 39 | 40 | echo "==> Downloading package and SHASUMs from https://nodejs.org/dist/" 41 | 42 | curl -sSLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" 43 | 44 | curl -sSLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" 45 | 46 | echo "==> Verifying package" 47 | gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc 48 | grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - 49 | 50 | echo "==> Installing Node.js v$NODE_VERSION in $INSTALL_DIR/usr/local" 51 | tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C $INSTALL_DIR/usr/local --strip-components=1 52 | 53 | echo "==> Cleaning up" 54 | rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt 55 | -------------------------------------------------------------------------------- /create-manifest: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright (c) 2015 Joyent Inc., All rights reserved. 4 | # 5 | # Create an image manifest for a given image file 6 | 7 | 8 | set -euo pipefail 9 | IFS=$'\n\t' 10 | 11 | now=$(date -u +%Y-%m-%dT%TZ) 12 | vm_uuid=$(uuid) 13 | SUM=/usr/bin/sum 14 | description= 15 | filename= 16 | kernel= 17 | min_platform= 18 | name= 19 | os= 20 | version= 21 | homepage= 22 | 23 | usage() 24 | { 25 | cat < -k -m -n -v 31 | 32 | OPTIONS: 33 | -d (optional, default: " VM Image") 34 | -f (required) 35 | -k (required) 36 | -m (required) 37 | -n (required) 38 | -o (optional, default: "other") 39 | -v (required) 40 | -h (optional) 41 | 42 | Example: 43 | 44 | $0 -f ubuntu-14.04.20150319.zfs.gz -k 3.13.0 -m 20150316T201553Z -n lx-ubuntu-14.04 -v 20150319 45 | 46 | USAGE 47 | exit 1 48 | } 49 | 50 | while getopts d:f:k:m:n:o:v:h:? OPTION 51 | do 52 | case $OPTION in 53 | d) 54 | description=${OPTARG} 55 | ;; 56 | f) 57 | filename=${OPTARG} 58 | ;; 59 | k) 60 | kernel=${OPTARG} 61 | ;; 62 | m) 63 | min_platform=${OPTARG} 64 | ;; 65 | n) 66 | name=${OPTARG} 67 | ;; 68 | o) 69 | os=${OPTARG} 70 | ;; 71 | v) 72 | version=${OPTARG} 73 | ;; 74 | h) 75 | homepage=${OPTARG} 76 | ;; 77 | \?) 78 | usage 79 | ;; 80 | esac 81 | done 82 | 83 | if [[ -z ${filename} || -z ${kernel} || -z ${min_platform} || -z ${name} || -z ${version} ]]; then 84 | echo "FATAL: All of -f, -k, -m, -n and -v are required." 85 | usage 86 | fi 87 | 88 | if [[ -z ${description} ]]; then 89 | description="${name} ${version} LX-brand image" 90 | fi 91 | 92 | if [[ -z ${os} ]]; then 93 | os="other" 94 | fi 95 | 96 | if [[ -z ${homepage} ]]; then 97 | homepage=https://docs.joyent.com/images 98 | fi 99 | 100 | if [[ ! -f ${filename} ]]; then 101 | echo "FATAL: ${filename} does not exist." 102 | usage 103 | fi 104 | 105 | shasum=$($SUM -x sha1 ${filename} | cut -d' ' -f1) 106 | filesize=$(wc -c < ${filename}) 107 | 108 | cat < -k -m -i -d -u 31 | 32 | Example: 33 | $0 -t /var/tmp/lx-ubuntu-14.04-20150408.tar.gz -k 3.13.0 -m 20150316T201553Z -i lx-ubuntu-14.04 -d "Ubuntu 14.04 lx 64-bit lx-brand image." -u https://docs.joyent.com/images/container-native-linux 34 | 35 | OPTIONS: 36 | -t The full path to the tar archive 37 | -k The kernel version 38 | -m The minimum platform required for the image 39 | -i The name of the image as it would appear in the manifest 40 | -d The description of the image as it would appear in the manifest 41 | -u The homepage link of the image as it would appear in the manifest 42 | -h Show this message 43 | 44 | EOF 45 | } 46 | 47 | while getopts "ht:k:m:i:d:u:" OPTION 48 | do 49 | case $OPTION in 50 | h) 51 | usage 52 | exit 1 53 | ;; 54 | t) 55 | TARBALL=${OPTARG} 56 | ;; 57 | k) 58 | KERNEL=${OPTARG} 59 | ;; 60 | m) 61 | MIN_PLATFORM=${OPTARG} 62 | ;; 63 | i) 64 | IMAGE_NAME=${OPTARG} 65 | ;; 66 | d) 67 | DESC=${OPTARG} 68 | ;; 69 | u) 70 | DOCS=${OPTARG} 71 | ;; 72 | ?) 73 | usage 74 | exit 75 | ;; 76 | esac 77 | done 78 | 79 | 80 | if [[ -z $TARBALL ]]; then 81 | echo "==> ERROR: the install archive is required" 82 | usage 83 | exit 1 84 | fi 85 | 86 | if [[ ! -a "$TARBALL" ]]; then 87 | printf "==> ERROR: %s: file or directory not found\n" $TARBALL 88 | exit 1 89 | fi 90 | 91 | if [[ "$(echo $TARBALL | cut -c 1)" != "/" ]]; then 92 | printf "==> Pathname '%s' specified to -t must be absolute\n" $TARBALL 93 | exit 1 94 | fi 95 | 96 | if [[ ! -r "$TARBALL" ]]; then 97 | printf "==> Cannot read file '%s'\n" $TARBALL 98 | exit 1 99 | fi 100 | 101 | if [[ ! -f "$TARBALL" ]]; then 102 | echo "==> ERROR: must be a gzip, bzip2, .Z or uncompressed tar archive" 103 | exit 1 104 | fi 105 | 106 | if [[ -z ${KERNEL} ]]; then 107 | echo "Error: missing kernel version (-k) value" 108 | exit 1 109 | fi 110 | 111 | if [[ -z ${MIN_PLATFORM} ]]; then 112 | echo "Error: missing minimum platform (-m) value" 113 | exit 1 114 | fi 115 | 116 | if [[ -z ${IMAGE_NAME} ]]; then 117 | echo "Error: missing image name (-i) value" 118 | exit 1 119 | fi 120 | 121 | if [[ -z ${DESC} ]]; then 122 | cho "Error: missing image description (-d) value" 123 | exit 1 124 | fi 125 | 126 | if [[ -z ${DOCS} ]]; then 127 | DOCS="https://docs.joyent.com/images/container-native-linux" 128 | fi 129 | 130 | IUUID=${IMAGE_NAME}-$BUILD_DATE 131 | 132 | filetype=$({ LC_ALL=C file $TARBALL | awk '{print $2}' ; } 2>/dev/null) 133 | 134 | if [[ "$filetype" = "gzip" ]]; then 135 | gtaropts="-xz" 136 | elif [[ "$filetype" = "bzip2" ]]; then 137 | gtaropts="-xj" 138 | elif [[ "$filetype" = "compressed" ]]; then 139 | gtaropts="-xZ" 140 | elif [[ "$filetype" = "USTAR" ]]; then 141 | gtaropts="-x" 142 | elif [[ "$filetype" = "xz" ]]; then 143 | gtaropts="-xJ" 144 | else 145 | printf "==> ERROR: must be a gzip, bzip2, .Z, xz or uncompressed tar archive" 146 | exit 1 147 | fi 148 | 149 | # Add -f flag 150 | gtaropts="${gtaropts}f" 151 | 152 | zpath="/zones/$IUUID" 153 | zroot="/zones/$IUUID/root" 154 | 155 | create_dataset() { 156 | echo "==> Creating dataset for image creation..." 157 | zfs create zones/$IUUID 158 | chmod 700 $zpath 159 | 160 | mkdir $zpath/root 161 | chmod 755 $zpath/root 162 | 163 | mkdir $zpath/cores 164 | chmod 755 $zpath/cores 165 | 166 | echo "==> The dataset is zones/$IUUID" 167 | echo "==>" 168 | } 169 | 170 | install_tar() { 171 | echo "==> Installing the tar archive, this will take a few minutes..." 172 | ( gtar "$gtaropts" "$TARBALL" -C "$zroot/" ) 173 | if [[ "$?" -ne "0" ]] ; then 174 | echo "==> Error: extraction from tar archive failed." 175 | zfs destroy -r zones/$IUUID 176 | fi 177 | } 178 | 179 | 180 | modify_image() { 181 | echo "==> Modifying the image to work in a zone..." 182 | 183 | echo "====> Creating /native directories..." 184 | mkdir -p $zroot/native/dev 185 | mkdir -p $zroot/native/etc/default 186 | mkdir -p $zroot/native/etc/svc/volatile 187 | mkdir -p $zroot/native/lib 188 | mkdir -p $zroot/native/proc 189 | mkdir -p $zroot/native/tmp 190 | chmod 1777 $zroot/native/tmp 191 | mkdir -p $zroot/native/usr 192 | mkdir -p $zroot/native/var 193 | echo "====> done." 194 | 195 | # Create the /var/ld/ld.config files that will point to /native/lib for our 196 | # Solaris libraries. 197 | 198 | echo "====> Creating the /var/ld/ld.config file..." 199 | mkdir $zroot/var/ld 200 | mkdir $zroot/var/ld/64 201 | 202 | if crle -c $zroot/var/ld/ld.config -l /native/lib:/native/usr/lib \ 203 | -s /native/lib/secure:/native/usr/lib/secure ; then 204 | echo "====> Created \"$zroot/var/ld/ld.config\"" 205 | else 206 | echo "====> Creation of \"$zroot/var/ld/ld.config\" failed!" 207 | exit 1 208 | fi 209 | 210 | if crle -64 -c $zroot/var/ld/64/ld.config \ 211 | -l /native/lib/amd64:/native/usr/lib/amd64 \ 212 | -s /native/lib/secure/amd64:/native/usr/lib/secure/amd64 ; then 213 | echo "====> Created \"$zroot/var/ld/64/ld.config\"" 214 | else 215 | echo "====> Creation of \"$zroot/var/ld/64/ld.config\" failed!" 216 | exit 1 217 | fi 218 | 219 | echo "====> Setting up fstab..." 220 | cat << EOF > $zroot/etc/fstab 221 | none / zfs defaults 1 1 222 | proc /proc proc defaults 0 0 223 | EOF 224 | 225 | echo "==> Image modification complete." 226 | } 227 | 228 | create_file() { 229 | echo "==> Creating image file:" 230 | 231 | echo "====> Creating snapshot..." 232 | zfs snapshot zones/$IUUID@final 233 | 234 | echo "====> Doing a zfs send. This may take a few minutes..." 235 | zfs send zones/$IUUID@final | gzip -9 > ${IMAGE_NAME}-${BUILD_DATE}.zfs.gz 236 | echo "====> Done." 237 | 238 | echo "====> Cleaning up..." 239 | zfs destroy -r zones/$IUUID 240 | 241 | echo "==> Image File created!" 242 | echo "==>" 243 | } 244 | 245 | create_manifest() { 246 | echo "==> Creating manifest file..." 247 | ./create-manifest -f ${IMAGE_NAME}-${BUILD_DATE}.zfs.gz -k ${KERNEL} -m ${MIN_PLATFORM} -n ${IMAGE_NAME} -o linux -v ${BUILD_DATE} -d ${DESC} -h ${DOCS} > ${IMAGE_NAME}-${BUILD_DATE}.json 248 | echo "==> done!" 249 | echo "==>" 250 | } 251 | 252 | show_image_files() { 253 | echo "*** Image creation complete ***" 254 | echo "==> Image files:" 255 | echo "${IMAGE_NAME}-${BUILD_DATE}.json" 256 | echo "${IMAGE_NAME}-${BUILD_DATE}.zfs.gz" 257 | echo "" 258 | } 259 | 260 | create_dataset 261 | install_tar 262 | modify_image 263 | create_file 264 | create_manifest 265 | show_image_files 266 | 267 | exit 0 268 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright (c) 2017 Joyent Inc., All rights reserved. 4 | # 5 | # Install Ubuntu 14.04 into a directory, modify the installation, then tar it up. 6 | # 7 | 8 | if [[ -n "$TRACE" ]]; then 9 | export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' 10 | set -o xtrace 11 | fi 12 | 13 | set -euo pipefail 14 | IFS=$'\n\t' 15 | 16 | GUESTTOOLS=guesttools 17 | BUILD_DATE=$(date +%Y%m%d) 18 | EXCLUDES=$PWD/exclude.txt 19 | 20 | usage() { 21 | cat < -a -d -m -i -p -D -u -c -b 27 | 28 | Example: 29 | $0 -r trusty -a amd64 -d /mnt/chroot -m http://archive.ubuntu.com/ubuntu/ -i lx-ubuntu-14.04 -p "Ubuntu 14.04 LX Brand" -D "Ubuntu 14.04 64-bit lx-brand image." -u https://docs.joyent.com/images/container-native-linux 30 | 31 | OPTIONS: 32 | -r The desired release (e.g "trusty") 33 | -a The desired architecture. Defaults to amd64 (64-bit). Use "i386" for 32-bit. [optional] 34 | -d A path to the install directory 35 | -m A URL for the desired archive mirror 36 | -i The name of the image. This is used for naming the tarball. 37 | -p The proper name of the image. Use quotes. This is used in the MOTD and /etc/product file. 38 | -D A description for the image. This is used in the image manifest and the /etc/product file. 39 | -u A URL to the image docs [optional] 40 | -c Customize file for image you want to create. customize.postgresql, customize.percona 41 | -o Optional arguments to be passed to the customize file. 42 | -b Base image name. ubuntu-14.04 43 | -h Show this message 44 | 45 | EOF 46 | } 47 | 48 | RELEASE= 49 | ARCH= 50 | INSTALL_DIR= 51 | MIRROR= 52 | IMAGE_NAME= 53 | NAME= 54 | DESC= 55 | DOCS= 56 | CUSTOMIZE= 57 | CUSTOM_OPTS= 58 | BASE_NAME= 59 | 60 | while getopts "hr:a:d:m:i:p:D:u:c:o:b:" OPTION 61 | do 62 | case $OPTION in 63 | h) 64 | usage 65 | exit 66 | ;; 67 | r) 68 | RELEASE=${OPTARG} 69 | ;; 70 | a) 71 | ARCH=${OPTARG} 72 | ;; 73 | d) 74 | INSTALL_DIR=${OPTARG%/} 75 | ;; 76 | m) 77 | MIRROR=${OPTARG} 78 | ;; 79 | i) 80 | IMAGE_NAME=${OPTARG} 81 | ;; 82 | p) 83 | NAME=${OPTARG} 84 | ;; 85 | D) 86 | DESC=${OPTARG} 87 | ;; 88 | u) 89 | DOCS=${OPTARG} 90 | ;; 91 | c) 92 | CUSTOMIZE=${OPTARG} 93 | ;; 94 | o) 95 | CUSTOM_OPTS=${OPTARG} 96 | ;; 97 | b) 98 | BASE_NAME=${OPTARG} 99 | ;; 100 | \?) 101 | usage 102 | exit 103 | ;; 104 | esac 105 | done 106 | 107 | if [[ $# -eq 0 ]]; then 108 | usage 109 | exit 1 110 | fi 111 | 112 | if [[ -z ${RELEASE} ]]; then 113 | echo "Error: missing release (-r) value" 114 | exit 1 115 | fi 116 | 117 | if [[ -z ${ARCH} ]]; then 118 | ARCH=amd64 119 | fi 120 | 121 | if [[ ! -e ${INSTALL_DIR} ]] ; then 122 | echo "Directory $INSTALL_DIR not found" 123 | exit 1 124 | fi 125 | 126 | if [[ -z ${INSTALL_DIR} ]]; then 127 | echo "Error: missing install directory (-d) value" 128 | exit 1 129 | fi 130 | 131 | if [[ -z ${MIRROR} ]]; then 132 | echo "Error: missing mirror (-m) value" 133 | exit 1 134 | fi 135 | 136 | if [[ -z ${IMAGE_NAME} ]]; then 137 | echo "Error: missing image name (-i) value" 138 | exit 1 139 | fi 140 | 141 | if [[ -z ${NAME} ]]; then 142 | echo "Error: missing proper name (-p) value" 143 | exit 1 144 | fi 145 | 146 | if [[ -z ${DESC} ]]; then 147 | echo "Error: missing image description (-D) value" 148 | exit 1 149 | fi 150 | 151 | TARGET="${IMAGE_NAME}-${BUILD_DATE}.tar.gz" 152 | 153 | if [[ -z ${DOCS} ]]; then 154 | DOCS="https://docs.joyent.com/images/container-native-linux" 155 | fi 156 | 157 | umount_chroot() { 158 | if grep -qs "$INSTALL_DIR/sys" $INSTALL_DIR/proc/mounts; then 159 | echo "====> Unmounting /sys in chroot" 160 | umount -lf $INSTALL_DIR/sys 161 | fi 162 | 163 | if grep -qs "$INSTALL_DIR/proc" $INSTALL_DIR/proc/mounts; then 164 | echo "====> Unmounting /proc in chroot" 165 | umount -lf $INSTALL_DIR/proc 166 | fi 167 | } 168 | 169 | echo "==> Installing $NAME into $INSTALL_DIR" 170 | 171 | if [[ -d $INSTALL_DIR ]]; then 172 | echo "====> Found previous install directory. Deleting and creating a new one." 173 | 174 | # umount previous /proc and /sys if they exist 175 | umount_chroot 176 | 177 | rm -rf $INSTALL_DIR 178 | mkdir -p $INSTALL_DIR 179 | fi 180 | 181 | debootstrap --components=main --arch=$ARCH \ 182 | --include=apt-transport-https,ca-certificates,curl,dbus,gettext-base,less,man-db,openssh-server,sudo,wget,vim \ 183 | $RELEASE $INSTALL_DIR $MIRROR 184 | echo "==> Done!" 185 | 186 | echo "==> Mounting /proc and /sys in chroot" 187 | chroot $INSTALL_DIR mount -t proc none /proc 188 | chroot $INSTALL_DIR mount -t sysfs sysfs /sys 189 | 190 | echo "==> Setting TZ to UTC" 191 | rm $INSTALL_DIR/etc/localtime 192 | cp $INSTALL_DIR/usr/share/zoneinfo/UTC $INSTALL_DIR/etc/localtime 193 | 194 | echo "==> Setting locale to en_US.UTF-8" 195 | export DEBIAN_FRONTEND=noninteractive 196 | chroot $INSTALL_DIR locale-gen en_US.UTF-8 197 | chroot $INSTALL_DIR dpkg-reconfigure locales 198 | echo "LANG=\"en_US.UTF-8\"" > $INSTALL_DIR/etc/default/locale 199 | 200 | echo "==> Updating $INSTALL_DIR/etc/apt/sources.list" 201 | cat << SOURCES > $INSTALL_DIR/etc/apt/sources.list 202 | deb http://archive.ubuntu.com/ubuntu $RELEASE main 203 | deb-src http://archive.ubuntu.com/ubuntu $RELEASE main 204 | deb http://archive.ubuntu.com/ubuntu $RELEASE-updates main 205 | deb-src http://archive.ubuntu.com/ubuntu $RELEASE-updates main 206 | deb http://security.ubuntu.com/ubuntu $RELEASE-security main 207 | deb-src http://security.ubuntu.com/ubuntu $RELEASE-security main 208 | 209 | deb http://archive.ubuntu.com/ubuntu $RELEASE universe 210 | deb-src http://archive.ubuntu.com/ubuntu $RELEASE universe 211 | deb http://archive.ubuntu.com/ubuntu $RELEASE-updates universe 212 | deb-src http://archive.ubuntu.com/ubuntu $RELEASE-updates universe 213 | deb http://security.ubuntu.com/ubuntu $RELEASE-security universe 214 | deb-src http://security.ubuntu.com/ubuntu $RELEASE-security universe 215 | SOURCES 216 | 217 | echo "==> Updating packages" 218 | 219 | # Disable services in chroot via divert before upgrading packages 220 | # See https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/430224 221 | chroot $INSTALL_DIR dpkg-divert --local --rename --add /sbin/initctl 222 | chroot $INSTALL_DIR ln -s /bin/true /sbin/initctl 223 | 224 | chroot $INSTALL_DIR apt-get -qq update 225 | chroot $INSTALL_DIR apt-get -qq upgrade 226 | 227 | echo "==> Installing additional packages" 228 | chroot $INSTALL_DIR apt-get -qq install --no-install-recommends python-software-properties software-properties-common 229 | 230 | # Get release version via os-release 231 | # shellcheck source=/dev/null 232 | CHECK_VERSION=$(echo "$(. $INSTALL_DIR/etc/os-release && echo $VERSION_ID)>14.04" | bc) 233 | 234 | if [[ "$CHECK_VERSION" -eq 1 ]]; then 235 | 236 | # Uninstall udev 237 | # See https://github.com/joyent/smartos-live/issues/596 238 | echo "Removing udev package" 239 | chroot $INSTALL_DIR apt-get -qq remove udev 240 | chroot $INSTALL_DIR apt-get -qq autoremove 241 | 242 | # Systemd overrides for Ubuntu 16.04 and newer 243 | # 244 | # See: 245 | # - https://github.com/joyent/centos-lx-brand-image-builder/issues/5 246 | # - https://github.com/joyent/centos-lx-brand-image-builder/issues/7 247 | # - https://smartos.org/bugview/OS-5304 248 | # 249 | # TODO: This should be removed when the relevant cgroup etc support is in 250 | # the platform. 251 | SERVICES=( systemd-hostnamed systemd-localed systemd-timedated ) 252 | 253 | for SERVICE in "${SERVICES[@]}"; do 254 | echo "==> Adding systemd overrides for $SERVICE" 255 | OVERRIDE_DIR=$INSTALL_DIR/etc/systemd/system/${SERVICE}.service.d 256 | mkdir -p $OVERRIDE_DIR 257 | 258 | cat << OVERRIDE > ${OVERRIDE_DIR}/override.conf 259 | [Service] 260 | PrivateTmp=no 261 | PrivateDevices=no 262 | PrivateNetwork=no 263 | ProtectSystem=no 264 | ProtectHome=no 265 | OVERRIDE 266 | done 267 | fi 268 | 269 | echo "==> Pinning makedev package" 270 | # Prevents apt-get upgrade issue when upgrading in a container environment. 271 | # Similar to https://bugs.launchpad.net/ubuntu/+source/makedev/+bug/1675163 272 | cat << MAKEDEV > $INSTALL_DIR/etc/apt/preferences.d/makedev 273 | Package: makedev 274 | Pin: release * 275 | Pin-Priority: -1 276 | MAKEDEV 277 | 278 | echo "==> Cleaning up caches etc." 279 | chroot $INSTALL_DIR apt-get -qq autoremove 280 | chroot $INSTALL_DIR apt-get -qq clean 281 | 282 | # Remove the divert that disables services 283 | chroot $INSTALL_DIR rm -f /sbin/initctl 284 | chroot $INSTALL_DIR dpkg-divert --local --rename --remove /sbin/initctl 285 | 286 | # Remove weekly cron for fstrim which doesn't make much sense for an 287 | # lx-brand image. 288 | if [[ -f $INSTALL_DIR/etc/cron.weekly/fstrim ]]; then 289 | echo "==> Removing /etc/cron.weekly/fstrim" 290 | rm -rf $INSTALL_DIR/etc/cron.weekly/fstrim 291 | fi 292 | 293 | echo "==> Disabling PasswordAuthentication" 294 | sed -ri s/^#?PasswordAuthentication\ no/PasswordAuthentication\ no/ -i $INSTALL_DIR/etc/ssh/sshd_config 295 | sed -ri s/^#?PasswordAuthentication\ yes/PasswordAuthentication\ no/ -i $INSTALL_DIR/etc/ssh/sshd_config 296 | 297 | echo "==> Removing resolvconf entries in $INSTALL_DIR/etc/resolvconf/resolv.conf.d/" 298 | rm -rf $INSTALL_DIR/etc/resolvconf/resolv.conf.d/tail 299 | rm -rf $INSTALL_DIR/etc/resolvconf/resolv.conf.d/original 300 | 301 | echo "==> Adding getty service on ttyS0 for 'vmadm console' command" 302 | cat << TTYS0 > $INSTALL_DIR/etc/init/ttyS0.conf 303 | # ttyS0 - getty 304 | # 305 | # This service maintains a getty on ttyS0 from the point the system is 306 | # started until it is shut down again. 307 | # On SmartOS and Smart Data Center this allows you to attach a console 308 | # via the 'vmadm console UUID' command 309 | 310 | start on stopped rc RUNLEVEL=[2345] and ( 311 | not-container or 312 | container CONTAINER=lxc or 313 | container CONTAINER=lxc-libvirt) 314 | 315 | stop on runlevel [!2345] 316 | 317 | respawn 318 | exec /sbin/getty -L 115200 ttyS0 vt102 319 | 320 | TTYS0 321 | 322 | 323 | echo "==> Creating /etc/motd" 324 | cat << MOTD > $INSTALL_DIR/etc/motd 325 | __ . . 326 | _| |_ | .-. . . .-. :--. |- 327 | |_ _| ;| || |(.-' | | | 328 | |__| \`--' \`-' \`;-| \`-' ' ' \`-' 329 | / ; Instance ($NAME $BUILD_DATE) 330 | \`-' $DOCS 331 | 332 | MOTD 333 | 334 | echo "==> Creating /etc/product file" 335 | cat << PRODUCT > $INSTALL_DIR/etc/product 336 | Name: Joyent Instance 337 | Image: $NAME $BUILD_DATE 338 | Base Image: $BASE_NAME 339 | Documentation: $DOCS 340 | Description: $DESC 341 | PRODUCT 342 | 343 | if [[ ! -d $INSTALL_DIR/var/svc ]]; then 344 | echo "==> Creating $INSTALL_DIR/var/svc" 345 | mkdir -p $INSTALL_DIR/var/svc 346 | fi 347 | 348 | if [[ ! -d $INSTALL_DIR/var/db ]]; then 349 | echo "==> Creating $INSTALL_DIR/var/db" 350 | mkdir -p $INSTALL_DIR/var/db 351 | fi 352 | 353 | 354 | echo "==> Installing Guest tools in $INSTALL_DIR" 355 | echo "====> Initiallizing and fetching submodule $GUESTTOOLS" 356 | git submodule init 357 | git submodule update 358 | 359 | echo "====> Running ./install.sh -i $INSTALL_DIR" 360 | ( 361 | cd $GUESTTOOLS 362 | ./install.sh -i $INSTALL_DIR 363 | ) 364 | 365 | echo "==> Installing dtracetools-lx in $INSTALL_DIR" 366 | echo "====> Downloading package and SHASUMs from https://us-east.manta.joyent.com/joyentsoln/public/" 367 | 368 | DTRACE_PACKAGE="dtracetools-lx_1.0_amd64.deb" 369 | D_PKG_SHASUM="shasum256.txt" 370 | 371 | curl -sSLO https://us-east.manta.joyent.com/joyentsoln/public/images/lx-brand/devel/packages/${DTRACE_PACKAGE} 372 | curl -sSLO https://us-east.manta.joyent.com/joyentsoln/public/images/lx-brand/devel/packages/${D_PKG_SHASUM} 373 | 374 | echo "====> Verifying package" 375 | grep " ${DTRACE_PACKAGE}\$" ${D_PKG_SHASUM} | sha256sum -c - 376 | 377 | echo "====> Installing into $INSTALL_DIR" 378 | dpkg --root $INSTALL_DIR -i ${DTRACE_PACKAGE} 379 | 380 | if [[ ! -z ${CUSTOMIZE} ]]; then 381 | echo "==> Executing ${CUSTOMIZE} file.." 382 | chmod +x ${CUSTOMIZE} 383 | if [[ -z ${CUSTOM_OPTS} ]]; then 384 | INSTALL_DIR="${INSTALL_DIR}" ./${CUSTOMIZE} 385 | else 386 | INSTALL_DIR="${INSTALL_DIR}" ./${CUSTOMIZE} ${CUSTOM_OPTS} 387 | fi 388 | fi 389 | 390 | echo "==> Saving installation as $TARGET. This may take a few minutes." 391 | tar --numeric-owner --create --auto-compress --exclude-from=$EXCLUDES --file "$TARGET" --directory "$INSTALL_DIR" --transform='s,^./,,' . 392 | 393 | echo "==> Installation complete!" 394 | echo "==> $TARGET" 395 | 396 | exit 0 397 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License, version 2.0 2 | 3 | 1. Definitions 4 | 5 | 1.1. "Contributor" 6 | 7 | means each individual or legal entity that creates, contributes to the 8 | creation of, or owns Covered Software. 9 | 10 | 1.2. "Contributor Version" 11 | 12 | means the combination of the Contributions of others (if any) used by a 13 | Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | 17 | means Covered Software of a particular Contributor. 18 | 19 | 1.4. "Covered Software" 20 | 21 | means Source Code Form to which the initial Contributor has attached the 22 | notice in Exhibit A, the Executable Form of such Source Code Form, and 23 | Modifications of such Source Code Form, in each case including portions 24 | thereof. 25 | 26 | 1.5. "Incompatible With Secondary Licenses" 27 | means 28 | 29 | a. that the initial Contributor has attached the notice described in 30 | Exhibit B to the Covered Software; or 31 | 32 | b. that the Covered Software was made available under the terms of 33 | version 1.1 or earlier of the License, but not also under the terms of 34 | a Secondary License. 35 | 36 | 1.6. "Executable Form" 37 | 38 | means any form of the work other than Source Code Form. 39 | 40 | 1.7. "Larger Work" 41 | 42 | means a work that combines Covered Software with other material, in a 43 | separate file or files, that is not Covered Software. 44 | 45 | 1.8. "License" 46 | 47 | means this document. 48 | 49 | 1.9. "Licensable" 50 | 51 | means having the right to grant, to the maximum extent possible, whether 52 | at the time of the initial grant or subsequently, any and all of the 53 | rights conveyed by this License. 54 | 55 | 1.10. "Modifications" 56 | 57 | means any of the following: 58 | 59 | a. any file in Source Code Form that results from an addition to, 60 | deletion from, or modification of the contents of Covered Software; or 61 | 62 | b. any new file in Source Code Form that contains any Covered Software. 63 | 64 | 1.11. "Patent Claims" of a Contributor 65 | 66 | means any patent claim(s), including without limitation, method, 67 | process, and apparatus claims, in any patent Licensable by such 68 | Contributor that would be infringed, but for the grant of the License, 69 | by the making, using, selling, offering for sale, having made, import, 70 | or transfer of either its Contributions or its Contributor Version. 71 | 72 | 1.12. "Secondary License" 73 | 74 | means either the GNU General Public License, Version 2.0, the GNU Lesser 75 | General Public License, Version 2.1, the GNU Affero General Public 76 | License, Version 3.0, or any later versions of those licenses. 77 | 78 | 1.13. "Source Code Form" 79 | 80 | means the form of the work preferred for making modifications. 81 | 82 | 1.14. "You" (or "Your") 83 | 84 | means an individual or a legal entity exercising rights under this 85 | License. For legal entities, "You" includes any entity that controls, is 86 | controlled by, or is under common control with You. For purposes of this 87 | definition, "control" means (a) the power, direct or indirect, to cause 88 | the direction or management of such entity, whether by contract or 89 | otherwise, or (b) ownership of more than fifty percent (50%) of the 90 | outstanding shares or beneficial ownership of such entity. 91 | 92 | 93 | 2. License Grants and Conditions 94 | 95 | 2.1. Grants 96 | 97 | Each Contributor hereby grants You a world-wide, royalty-free, 98 | non-exclusive license: 99 | 100 | a. under intellectual property rights (other than patent or trademark) 101 | Licensable by such Contributor to use, reproduce, make available, 102 | modify, display, perform, distribute, and otherwise exploit its 103 | Contributions, either on an unmodified basis, with Modifications, or 104 | as part of a Larger Work; and 105 | 106 | b. under Patent Claims of such Contributor to make, use, sell, offer for 107 | sale, have made, import, and otherwise transfer either its 108 | Contributions or its Contributor Version. 109 | 110 | 2.2. Effective Date 111 | 112 | The licenses granted in Section 2.1 with respect to any Contribution 113 | become effective for each Contribution on the date the Contributor first 114 | distributes such Contribution. 115 | 116 | 2.3. Limitations on Grant Scope 117 | 118 | The licenses granted in this Section 2 are the only rights granted under 119 | this License. No additional rights or licenses will be implied from the 120 | distribution or licensing of Covered Software under this License. 121 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 122 | Contributor: 123 | 124 | a. for any code that a Contributor has removed from Covered Software; or 125 | 126 | b. for infringements caused by: (i) Your and any other third party's 127 | modifications of Covered Software, or (ii) the combination of its 128 | Contributions with other software (except as part of its Contributor 129 | Version); or 130 | 131 | c. under Patent Claims infringed by Covered Software in the absence of 132 | its Contributions. 133 | 134 | This License does not grant any rights in the trademarks, service marks, 135 | or logos of any Contributor (except as may be necessary to comply with 136 | the notice requirements in Section 3.4). 137 | 138 | 2.4. Subsequent Licenses 139 | 140 | No Contributor makes additional grants as a result of Your choice to 141 | distribute the Covered Software under a subsequent version of this 142 | License (see Section 10.2) or under the terms of a Secondary License (if 143 | permitted under the terms of Section 3.3). 144 | 145 | 2.5. Representation 146 | 147 | Each Contributor represents that the Contributor believes its 148 | Contributions are its original creation(s) or it has sufficient rights to 149 | grant the rights to its Contributions conveyed by this License. 150 | 151 | 2.6. Fair Use 152 | 153 | This License is not intended to limit any rights You have under 154 | applicable copyright doctrines of fair use, fair dealing, or other 155 | equivalents. 156 | 157 | 2.7. Conditions 158 | 159 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in 160 | Section 2.1. 161 | 162 | 163 | 3. Responsibilities 164 | 165 | 3.1. Distribution of Source Form 166 | 167 | All distribution of Covered Software in Source Code Form, including any 168 | Modifications that You create or to which You contribute, must be under 169 | the terms of this License. You must inform recipients that the Source 170 | Code Form of the Covered Software is governed by the terms of this 171 | License, and how they can obtain a copy of this License. You may not 172 | attempt to alter or restrict the recipients' rights in the Source Code 173 | Form. 174 | 175 | 3.2. Distribution of Executable Form 176 | 177 | If You distribute Covered Software in Executable Form then: 178 | 179 | a. such Covered Software must also be made available in Source Code Form, 180 | as described in Section 3.1, and You must inform recipients of the 181 | Executable Form how they can obtain a copy of such Source Code Form by 182 | reasonable means in a timely manner, at a charge no more than the cost 183 | of distribution to the recipient; and 184 | 185 | b. You may distribute such Executable Form under the terms of this 186 | License, or sublicense it under different terms, provided that the 187 | license for the Executable Form does not attempt to limit or alter the 188 | recipients' rights in the Source Code Form under this License. 189 | 190 | 3.3. Distribution of a Larger Work 191 | 192 | You may create and distribute a Larger Work under terms of Your choice, 193 | provided that You also comply with the requirements of this License for 194 | the Covered Software. If the Larger Work is a combination of Covered 195 | Software with a work governed by one or more Secondary Licenses, and the 196 | Covered Software is not Incompatible With Secondary Licenses, this 197 | License permits You to additionally distribute such Covered Software 198 | under the terms of such Secondary License(s), so that the recipient of 199 | the Larger Work may, at their option, further distribute the Covered 200 | Software under the terms of either this License or such Secondary 201 | License(s). 202 | 203 | 3.4. Notices 204 | 205 | You may not remove or alter the substance of any license notices 206 | (including copyright notices, patent notices, disclaimers of warranty, or 207 | limitations of liability) contained within the Source Code Form of the 208 | Covered Software, except that You may alter any license notices to the 209 | extent required to remedy known factual inaccuracies. 210 | 211 | 3.5. Application of Additional Terms 212 | 213 | You may choose to offer, and to charge a fee for, warranty, support, 214 | indemnity or liability obligations to one or more recipients of Covered 215 | Software. However, You may do so only on Your own behalf, and not on 216 | behalf of any Contributor. You must make it absolutely clear that any 217 | such warranty, support, indemnity, or liability obligation is offered by 218 | You alone, and You hereby agree to indemnify every Contributor for any 219 | liability incurred by such Contributor as a result of warranty, support, 220 | indemnity or liability terms You offer. You may include additional 221 | disclaimers of warranty and limitations of liability specific to any 222 | jurisdiction. 223 | 224 | 4. Inability to Comply Due to Statute or Regulation 225 | 226 | If it is impossible for You to comply with any of the terms of this License 227 | with respect to some or all of the Covered Software due to statute, 228 | judicial order, or regulation then You must: (a) comply with the terms of 229 | this License to the maximum extent possible; and (b) describe the 230 | limitations and the code they affect. Such description must be placed in a 231 | text file included with all distributions of the Covered Software under 232 | this License. Except to the extent prohibited by statute or regulation, 233 | such description must be sufficiently detailed for a recipient of ordinary 234 | skill to be able to understand it. 235 | 236 | 5. Termination 237 | 238 | 5.1. The rights granted under this License will terminate automatically if You 239 | fail to comply with any of its terms. However, if You become compliant, 240 | then the rights granted under this License from a particular Contributor 241 | are reinstated (a) provisionally, unless and until such Contributor 242 | explicitly and finally terminates Your grants, and (b) on an ongoing 243 | basis, if such Contributor fails to notify You of the non-compliance by 244 | some reasonable means prior to 60 days after You have come back into 245 | compliance. Moreover, Your grants from a particular Contributor are 246 | reinstated on an ongoing basis if such Contributor notifies You of the 247 | non-compliance by some reasonable means, this is the first time You have 248 | received notice of non-compliance with this License from such 249 | Contributor, and You become compliant prior to 30 days after Your receipt 250 | of the notice. 251 | 252 | 5.2. If You initiate litigation against any entity by asserting a patent 253 | infringement claim (excluding declaratory judgment actions, 254 | counter-claims, and cross-claims) alleging that a Contributor Version 255 | directly or indirectly infringes any patent, then the rights granted to 256 | You by any and all Contributors for the Covered Software under Section 257 | 2.1 of this License shall terminate. 258 | 259 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user 260 | license agreements (excluding distributors and resellers) which have been 261 | validly granted by You or Your distributors under this License prior to 262 | termination shall survive termination. 263 | 264 | 6. Disclaimer of Warranty 265 | 266 | Covered Software is provided under this License on an "as is" basis, 267 | without warranty of any kind, either expressed, implied, or statutory, 268 | including, without limitation, warranties that the Covered Software is free 269 | of defects, merchantable, fit for a particular purpose or non-infringing. 270 | The entire risk as to the quality and performance of the Covered Software 271 | is with You. Should any Covered Software prove defective in any respect, 272 | You (not any Contributor) assume the cost of any necessary servicing, 273 | repair, or correction. This disclaimer of warranty constitutes an essential 274 | part of this License. No use of any Covered Software is authorized under 275 | this License except under this disclaimer. 276 | 277 | 7. Limitation of Liability 278 | 279 | Under no circumstances and under no legal theory, whether tort (including 280 | negligence), contract, or otherwise, shall any Contributor, or anyone who 281 | distributes Covered Software as permitted above, be liable to You for any 282 | direct, indirect, special, incidental, or consequential damages of any 283 | character including, without limitation, damages for lost profits, loss of 284 | goodwill, work stoppage, computer failure or malfunction, or any and all 285 | other commercial damages or losses, even if such party shall have been 286 | informed of the possibility of such damages. This limitation of liability 287 | shall not apply to liability for death or personal injury resulting from 288 | such party's negligence to the extent applicable law prohibits such 289 | limitation. Some jurisdictions do not allow the exclusion or limitation of 290 | incidental or consequential damages, so this exclusion and limitation may 291 | not apply to You. 292 | 293 | 8. Litigation 294 | 295 | Any litigation relating to this License may be brought only in the courts 296 | of a jurisdiction where the defendant maintains its principal place of 297 | business and such litigation shall be governed by laws of that 298 | jurisdiction, without reference to its conflict-of-law provisions. Nothing 299 | in this Section shall prevent a party's ability to bring cross-claims or 300 | counter-claims. 301 | 302 | 9. Miscellaneous 303 | 304 | This License represents the complete agreement concerning the subject 305 | matter hereof. If any provision of this License is held to be 306 | unenforceable, such provision shall be reformed only to the extent 307 | necessary to make it enforceable. Any law or regulation which provides that 308 | the language of a contract shall be construed against the drafter shall not 309 | be used to construe this License against a Contributor. 310 | 311 | 312 | 10. Versions of the License 313 | 314 | 10.1. New Versions 315 | 316 | Mozilla Foundation is the license steward. Except as provided in Section 317 | 10.3, no one other than the license steward has the right to modify or 318 | publish new versions of this License. Each version will be given a 319 | distinguishing version number. 320 | 321 | 10.2. Effect of New Versions 322 | 323 | You may distribute the Covered Software under the terms of the version 324 | of the License under which You originally received the Covered Software, 325 | or under the terms of any subsequent version published by the license 326 | steward. 327 | 328 | 10.3. Modified Versions 329 | 330 | If you create software not governed by this License, and you want to 331 | create a new license for such software, you may create and use a 332 | modified version of this License if you rename the license and remove 333 | any references to the name of the license steward (except to note that 334 | such modified license differs from this License). 335 | 336 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 337 | Licenses If You choose to distribute Source Code Form that is 338 | Incompatible With Secondary Licenses under the terms of this version of 339 | the License, the notice described in Exhibit B of this License must be 340 | attached. 341 | 342 | Exhibit A - Source Code Form License Notice 343 | 344 | This Source Code Form is subject to the 345 | terms of the Mozilla Public License, v. 346 | 2.0. If a copy of the MPL was not 347 | distributed with this file, You can 348 | obtain one at 349 | http://mozilla.org/MPL/2.0/. 350 | 351 | If it is not possible or desirable to put the notice in a particular file, 352 | then You may include the notice in a location (such as a LICENSE file in a 353 | relevant directory) where a recipient would be likely to look for such a 354 | notice. 355 | 356 | You may add additional accurate notices of copyright ownership. 357 | 358 | Exhibit B - "Incompatible With Secondary Licenses" Notice 359 | 360 | This Source Code Form is "Incompatible 361 | With Secondary Licenses", as defined by 362 | the Mozilla Public License, v. 2.0. 363 | --------------------------------------------------------------------------------