|
#!/bin/bash |
|
cat <<"USAGE" |
|
This script is downloading Boot2Docker-1.3.0.pkg which |
|
contains 7 subpackages: |
|
|
|
DockerCLI Boot2DockerCLI Boot2DockerISO Boot2DockerAPP VBoxKEXTs VBox VBoxCLI |
|
|
|
You will have a choice, to select which to install |
|
|
|
Usage: |
|
======================================================= |
|
curl -Lo /tmp/b2d-130 j.mp/b2d-130 && . /tmp/b2d-130 |
|
======================================================= |
|
|
|
README: https://gist.github.com/lalyos/f8cc8dd77f1e1ab5e628 |
|
USAGE |
|
|
|
: ${B2D_PKD:=~/Downloads/Boot2Docker-1.3.0.pkg} |
|
|
|
if [ -f $B2D_PKD ]; then |
|
echo [INFO] PKG already downloaded: $B2D_PKD |
|
else |
|
echo [INFO] Downloading PKG to: $B2D_PKD |
|
echo [INFO] It will take a couple of minutes, meanwhile read: https://gist.github.com/lalyos/f8cc8dd77f1e1ab5e628 |
|
open https://gist.github.com/lalyos/f8cc8dd77f1e1ab5e628 |
|
curl -Lo $B2D_PKD https://github.com/boot2docker/osx-installer/releases/download/v1.3.0/Boot2Docker-1.3.0.pkg |
|
fi |
|
|
|
PACKAGES="DockerCLI Boot2DockerCLI Boot2DockerISO Boot2DockerAPP VBoxKEXTs VBox VBoxCLI" |
|
|
|
pkg-reset() { |
|
for var in $PACKAGES; do |
|
eval ${var}=0 |
|
done |
|
} |
|
|
|
pkg-show() { |
|
echo -n '[ ' |
|
for var in $PACKAGES; do |
|
echo -n "${var}:${!var} " |
|
done |
|
echo ']' |
|
} |
|
|
|
pkg-choose() { |
|
cat <<USAGE |
|
======================================== |
|
choose which package you want to install |
|
1-7: togles the package |
|
q: finish selecting |
|
======================================== |
|
USAGE |
|
select pack in $PACKAGES; do |
|
[[ "$REPLY" == "q" || "$REPLY" == "x" || "$REPLY" == "quit" ]] && break |
|
echo togle: $pack |
|
eval ${pack}=$(( 1 - ${!pack} )) |
|
pkg-show |
|
done |
|
} |
|
|
|
pkg-create-choice-file() { |
|
cat > /tmp/b2d-single-pack.plist <<EOF |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
<plist version="1.0"> |
|
<array> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${DockerCLI}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceDockerCLI</string> |
|
</dict> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${Boot2DockerCLI}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceBoot2DockerCLI</string> |
|
</dict> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${Boot2DockerISO}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceBoot2DockerISO</string> |
|
</dict> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${Boot2DockerAPP}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceBoot2DockerAPP</string> |
|
</dict> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${VBoxKEXTs}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceVBoxKEXTs</string> |
|
</dict> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${VBox}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceVBox</string> |
|
</dict> |
|
<dict> |
|
<key>attributeSetting</key> |
|
<integer>${VBoxCLI}</integer> |
|
<key>choiceAttribute</key> |
|
<string>selected</string> |
|
<key>choiceIdentifier</key> |
|
<string>choiceVBoxCLI</string> |
|
</dict> |
|
</array> |
|
</plist> |
|
EOF |
|
} |
|
|
|
fix-up() { |
|
echo [INFO] fix boot2docker.iso localtion |
|
cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ 2>/dev/null |
|
|
|
# checks which profiles exists |
|
if [ -f ~/.bash_profile ] ; then |
|
PRO_FILE=~/.bash_profile |
|
else |
|
PRO_FILE=~/.profile |
|
fi |
|
|
|
# updates profile to use the default virtualenv |
|
cat >>$PRO_FILE <<"ENDOFPROFILE" |
|
|
|
# Docker settings |
|
$(boot2docker shellinit) |
|
ENDOFPROFILE |
|
} |
|
|
|
pkg-reset |
|
pkg-choose |
|
pkg-create-choice-file |
|
|
|
echo [INFO] the installer need sudo rights, please enter you password |
|
sudo installer -package $B2D_PKD -target / -applyChoiceChangesXML /tmp/b2d-single-pack.plist -dumplog |
|
fix-up |