|
|
@ -2,10 +2,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
|
|
# The default ZSH to use.
|
|
|
|
# The default ZSH to use; it can just be the first few characters.
|
|
|
|
default_version='4.3.11'
|
|
|
|
# This should be the oldest version we support.
|
|
|
|
|
|
|
|
default_version='4.'
|
|
|
|
|
|
|
|
|
|
|
|
setopt extended_glob glob_subst numeric_glob_sort
|
|
|
|
setopt extended_glob glob_subst numeric_glob_sort
|
|
|
|
|
|
|
|
setopt warn_create_global warn_nested_var 2> /dev/null
|
|
|
|
cd "${${(%):-%x}:A:h}"
|
|
|
|
cd "${${(%):-%x}:A:h}"
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Crazy Logic to munge TERM to something supported in Ubuntu 14.04
|
|
|
|
# TODO: Crazy Logic to munge TERM to something supported in Ubuntu 14.04
|
|
|
@ -15,13 +17,18 @@ term=screen-256color
|
|
|
|
# ...see Modifiers in zshexpn(1) for details.
|
|
|
|
# ...see Modifiers in zshexpn(1) for details.
|
|
|
|
|
|
|
|
|
|
|
|
# List of ZSH versions
|
|
|
|
# List of ZSH versions
|
|
|
|
typeset -a versions
|
|
|
|
typeset -aU versions
|
|
|
|
versions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) )
|
|
|
|
versions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) )
|
|
|
|
|
|
|
|
typeset -r versions
|
|
|
|
|
|
|
|
|
|
|
|
# List of frameworks
|
|
|
|
# List of frameworks
|
|
|
|
typeset -a frameworks
|
|
|
|
typeset -aU frameworks
|
|
|
|
frameworks=( docker/*/Dockerfile(N.on:h:t) )
|
|
|
|
frameworks=( docker/*/Dockerfile(N.on:h:t) )
|
|
|
|
frameworks=${(@)frameworks:#base-*}
|
|
|
|
for i in {$#frameworks..1}; do
|
|
|
|
|
|
|
|
# Remove all base entries
|
|
|
|
|
|
|
|
[[ "${frameworks[$i]}" == base-* ]] && frameworks[$i]=()
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
typeset -r frameworks
|
|
|
|
|
|
|
|
|
|
|
|
# Known Issues
|
|
|
|
# Known Issues
|
|
|
|
typeset -A known_issues
|
|
|
|
typeset -A known_issues
|
|
|
@ -30,6 +37,7 @@ known_issues["4.3.11-zim"]="BROKEN: Zim wants ZSH 5.2 or newer."
|
|
|
|
known_issues["5.0.3-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer."
|
|
|
|
known_issues["5.0.3-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer."
|
|
|
|
known_issues["5.1.1-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer."
|
|
|
|
known_issues["5.1.1-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer."
|
|
|
|
known_issues["4.3.11-zulu"]="Zulu doesn't work; it needs a newer version of git."
|
|
|
|
known_issues["4.3.11-zulu"]="Zulu doesn't work; it needs a newer version of git."
|
|
|
|
|
|
|
|
typeset -r known_issues
|
|
|
|
|
|
|
|
|
|
|
|
err()
|
|
|
|
err()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -65,6 +73,14 @@ check_for_known_issues() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd() {
|
|
|
|
|
|
|
|
if (( dry_run )); then
|
|
|
|
|
|
|
|
echo "${(@q)*}" 1>&2
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
"${(@)*}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
build_and_run() {
|
|
|
|
build_and_run() {
|
|
|
|
local version="$1"
|
|
|
|
local version="$1"
|
|
|
|
local framework="$2"
|
|
|
|
local framework="$2"
|
|
|
@ -75,14 +91,14 @@ build_and_run() {
|
|
|
|
print -P "%F{green}Preparing containers...%f"
|
|
|
|
print -P "%F{green}Preparing containers...%f"
|
|
|
|
|
|
|
|
|
|
|
|
echo -n "p9k:base-${version}: "
|
|
|
|
echo -n "p9k:base-${version}: "
|
|
|
|
docker build \
|
|
|
|
cmd docker build \
|
|
|
|
--quiet \
|
|
|
|
--quiet \
|
|
|
|
--tag "p9k:base-${version}" \
|
|
|
|
--tag "p9k:base-${version}" \
|
|
|
|
--file "docker/base-${version}/Dockerfile" \
|
|
|
|
--file "docker/base-${version}/Dockerfile" \
|
|
|
|
.
|
|
|
|
.
|
|
|
|
|
|
|
|
|
|
|
|
echo -n "p9k:${version}-${framework}: "
|
|
|
|
echo -n "p9k:${version}-${framework}: "
|
|
|
|
docker build \
|
|
|
|
cmd docker build \
|
|
|
|
--quiet \
|
|
|
|
--quiet \
|
|
|
|
--build-arg="base=base-${version}" \
|
|
|
|
--build-arg="base=base-${version}" \
|
|
|
|
--tag "p9k:${version}-${framework}" \
|
|
|
|
--tag "p9k:${version}-${framework}" \
|
|
|
@ -90,7 +106,7 @@ build_and_run() {
|
|
|
|
.
|
|
|
|
.
|
|
|
|
|
|
|
|
|
|
|
|
print -P "%F{green}Starting ${name} container...%f"
|
|
|
|
print -P "%F{green}Starting ${name} container...%f"
|
|
|
|
exec docker run \
|
|
|
|
cmd docker run \
|
|
|
|
--rm \
|
|
|
|
--rm \
|
|
|
|
--interactive \
|
|
|
|
--interactive \
|
|
|
|
--tty \
|
|
|
|
--tty \
|
|
|
@ -105,9 +121,10 @@ show_help() {
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "Loads up a docker image with powershell9k configured in <framework>"
|
|
|
|
echo "Loads up a docker image with powershell9k configured in <framework>"
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo " --frameworks Lists all available frameworks, newline separated."
|
|
|
|
echo " -f --frameworks Lists all available frameworks, newline separated."
|
|
|
|
echo " --versions Lists all available ZSH versions, newline separated."
|
|
|
|
echo " -v --versions Lists all available ZSH versions, newline separated."
|
|
|
|
echo " --zsh VER Uses ZSH with version VER."
|
|
|
|
echo " -z --zsh VER Uses ZSH with version VER."
|
|
|
|
|
|
|
|
echo " -n --dry-run Just prints the docker commands that would be run."
|
|
|
|
echo " --help You're soaking in it."
|
|
|
|
echo " --help You're soaking in it."
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "ZSH versions:"
|
|
|
|
echo "ZSH versions:"
|
|
|
@ -128,8 +145,9 @@ if (( $# == 0 )); then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Parse flags and such.
|
|
|
|
# Parse flags and such.
|
|
|
|
use_version=$default_version
|
|
|
|
asked_for_version=$default_version
|
|
|
|
use_framework=
|
|
|
|
asked_for_framework=
|
|
|
|
|
|
|
|
dry_run=0
|
|
|
|
while (( $# > 0 )); do
|
|
|
|
while (( $# > 0 )); do
|
|
|
|
case "$1" in
|
|
|
|
case "$1" in
|
|
|
|
-f | --frameworks )
|
|
|
|
-f | --frameworks )
|
|
|
@ -142,13 +160,9 @@ while (( $# > 0 )); do
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-z | --zsh )
|
|
|
|
-z | --zsh )
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
local v="$(resolve_version "$1")"
|
|
|
|
asked_for_version=$1
|
|
|
|
if [[ -n "$v" ]]; then
|
|
|
|
|
|
|
|
use_version=$v
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
err "No such ZSH version '${1}'"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
-n | --dry-run ) dry_run=1 ;;
|
|
|
|
-h | --help )
|
|
|
|
-h | --help )
|
|
|
|
show_help
|
|
|
|
show_help
|
|
|
|
exit
|
|
|
|
exit
|
|
|
@ -159,21 +173,28 @@ while (( $# > 0 )); do
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
if [[ -z "$use_framework" ]]; then
|
|
|
|
if [[ -z "$asked_for_framework" ]]; then
|
|
|
|
local f="$(resolve_framework "$1")"
|
|
|
|
asked_for_framework=$1
|
|
|
|
if [[ -n "$f" ]]; then
|
|
|
|
|
|
|
|
use_framework=$f
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
err "No such framework '${1}'"
|
|
|
|
err "You can only specify one framework at a time; you already specified '${asked_for_framework}'"
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
err "You can only specify one framework at a time; you already specified '${use_framework}'"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typeset -r asked_for_version asked_for_framework
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typeset -r use_version="$(resolve_version "${asked_for_version}")"
|
|
|
|
|
|
|
|
if [[ -z "$use_version" ]]; then
|
|
|
|
|
|
|
|
err "No such ZSH version '${asked_for_version}'"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typeset -r use_framework="$(resolve_framework "${asked_for_framework}")"
|
|
|
|
|
|
|
|
if [[ -z "$use_framework" ]]; then
|
|
|
|
|
|
|
|
err "No such framework '${asked_for_framework}'"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
build_and_run "$use_version" "$use_framework"
|
|
|
|
build_and_run "$use_version" "$use_framework"
|
|
|
|
|
|
|
|
|
|
|
|
# EOF
|
|
|
|
# EOF
|
|
|
|