2 Star 0 Fork 0

mirrors_sfackler/official-images

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build-and-push.sh 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
Tianon Gravi 提交于 2017-06-14 14:51 . Fix "build-and-push.sh"
#!/bin/bash
set -eu -o pipefail
# set "$0" so that tmux shows something more useful than "bash" in the statusbar
desired0='b-a-p'
if ! grep -q "$desired0" "/proc/$$/cmdline"; then
exec -a "$desired0" "$SHELL" -- "$BASH_SOURCE" "$@"
fi
if [ "$#" -eq 0 ]; then
self="$(basename "$0")"
cat >&2 <<-EOF
error: missing arguments
usage: $self <build args>
ie: $self debian ubuntu
EOF
exit 1
fi
# allow for specifying an alternate path to "bashbrew"
: "${BASHBREW:=bashbrew}"
# normalize "$@" to be the "--uniq" versions (and deduplicate)
# also grab the list of associated repos in explicit build order (so we can build/push grouped by repo)
IFS=$'\n'
set -- $("$BASHBREW" list --uniq --repos "$@" | sort -u | xargs "$BASHBREW" list --uniq --repos --build-order --apply-constraints)
repos=( $(echo "$*" | cut -d: -f1 | xargs "$BASHBREW" list --repos --build-order --apply-constraints) )
unset IFS
declare -A repoTags=()
for repoTag; do
repo="${repoTag%%:*}"
repoTags[$repo]+=" $repoTag"
done
# fill "$@" back up with the corrected build order (especially for the "Children:" output)
set --
for repo in "${repos[@]}"; do
set -- "$@" ${repoTags[$repo]}
done
children="$("$(dirname "$BASH_SOURCE")/children.sh" "$@")"
echo
echo
echo "Children: (of $*)"
echo "${children:-<none>}"
echo
echo
for repo in "${repos[@]}"; do
tags=( ${repoTags[$repo]} )
(
set -x
time "$BASHBREW" build "${tags[@]}"
time "$BASHBREW" tag "${tags[@]}"
time "$BASHBREW" push "${tags[@]}"
)
done
echo
echo
echo "Children: (of $*)"
echo "${children:-<none>}"
echo
echo
if [ "$children" ]; then
echo 'Suggested command:'
echo " ./children.sh $* | xargs ./build-and-push.sh"
echo
fi
# end by printing only warnings (stderr) for images we skipped (such as "windowsservercore" when building on Linux)
# this helps remind us to switch BASHBREW or servers
"$BASHBREW" list --apply-constraints "$@" > /dev/null
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_sfackler/official-images.git
[email protected]:mirrors_sfackler/official-images.git
mirrors_sfackler
official-images
official-images
master

搜索帮助