make.sh: Fix
This commit is contained in:
parent
c4ef432daf
commit
11a93df61c
4 changed files with 46 additions and 22 deletions
|
|
@ -55,12 +55,14 @@ tput() {
|
|||
|
||||
should_color() {
|
||||
if [ -n "${COLOR-}" ]; then
|
||||
if [ "$COLOR" = 0 -o "$COLOR" = false ]; then
|
||||
_COLOR=
|
||||
return 1
|
||||
elif [ "$COLOR" = 1 -o "$COLOR" = true ]; then
|
||||
if [ "$COLOR" = 1 -o "$COLOR" = true ]; then
|
||||
_COLOR=1
|
||||
__COLOR=1
|
||||
return 0
|
||||
elif [ "$COLOR" = 0 -o "$COLOR" = false ]; then
|
||||
_COLOR=
|
||||
__COLOR=0
|
||||
return 1
|
||||
else
|
||||
printf '$COLOR must be 0, 1, false or true but got %s\n' "$COLOR" >&2
|
||||
fi
|
||||
|
|
@ -68,9 +70,11 @@ should_color() {
|
|||
|
||||
if [ -t 1 -a "${TERM-}" != dumb ]; then
|
||||
_COLOR=1
|
||||
__COLOR=1
|
||||
return 0
|
||||
else
|
||||
_COLOR=
|
||||
__COLOR=0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
@ -114,9 +118,9 @@ printfp() {(
|
|||
fi
|
||||
should_color || true
|
||||
if [ $# -eq 0 ]; then
|
||||
printf '%s' "$(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix")"
|
||||
printf '%s' "$(COLOR=$__COLOR setaf "$FGCOLOR" "$prefix")"
|
||||
else
|
||||
printf '%s: %s\n' "$(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix")" "$(printf "$@")"
|
||||
printf '%s: %s\n' "$(COLOR=$__COLOR setaf "$FGCOLOR" "$prefix")" "$(printf "$@")"
|
||||
fi
|
||||
)}
|
||||
|
||||
|
|
@ -125,7 +129,7 @@ catp() {
|
|||
shift
|
||||
|
||||
should_color || true
|
||||
sed "s/^/$(COLOR=${_COLOR-} printfp "$prefix" '')/"
|
||||
sed "s/^/$(COLOR=$__COLOR printfp "$prefix" '')/"
|
||||
}
|
||||
|
||||
repeat() {
|
||||
|
|
@ -152,17 +156,17 @@ printferr() {
|
|||
|
||||
logp() {
|
||||
should_color >&2 || true
|
||||
COLOR=${_COLOR-} echop "$@" | humanpath >&2
|
||||
COLOR=$__COLOR echop "$@" | humanpath >&2
|
||||
}
|
||||
|
||||
logfp() {
|
||||
should_color >&2 || true
|
||||
COLOR=${_COLOR-} printfp "$@" | humanpath >&2
|
||||
COLOR=$__COLOR printfp "$@" | humanpath >&2
|
||||
}
|
||||
|
||||
logpcat() {
|
||||
should_color >&2 || true
|
||||
COLOR=${_COLOR-} catp "$@" | humanpath >&2
|
||||
COLOR=$__COLOR catp "$@" | humanpath >&2
|
||||
}
|
||||
|
||||
log() {
|
||||
|
|
@ -287,3 +291,10 @@ runtty() {
|
|||
return 1
|
||||
esac
|
||||
}
|
||||
|
||||
capcode() {
|
||||
set +e
|
||||
"$@"
|
||||
code=$?
|
||||
set -e
|
||||
}
|
||||
|
|
|
|||
2
ci/sub
2
ci/sub
|
|
@ -1 +1 @@
|
|||
Subproject commit 0dacc9c6cee5b8d901f22f57e9dc7f9acf640cbc
|
||||
Subproject commit 702b771228f41e5485b5f3f593ce79f6efcb555d
|
||||
31
install.sh
31
install.sh
|
|
@ -61,12 +61,14 @@ tput() {
|
|||
|
||||
should_color() {
|
||||
if [ -n "${COLOR-}" ]; then
|
||||
if [ "$COLOR" = 0 -o "$COLOR" = false ]; then
|
||||
_COLOR=
|
||||
return 1
|
||||
elif [ "$COLOR" = 1 -o "$COLOR" = true ]; then
|
||||
if [ "$COLOR" = 1 -o "$COLOR" = true ]; then
|
||||
_COLOR=1
|
||||
__COLOR=1
|
||||
return 0
|
||||
elif [ "$COLOR" = 0 -o "$COLOR" = false ]; then
|
||||
_COLOR=
|
||||
__COLOR=0
|
||||
return 1
|
||||
else
|
||||
printf '$COLOR must be 0, 1, false or true but got %s\n' "$COLOR" >&2
|
||||
fi
|
||||
|
|
@ -74,9 +76,11 @@ should_color() {
|
|||
|
||||
if [ -t 1 -a "${TERM-}" != dumb ]; then
|
||||
_COLOR=1
|
||||
__COLOR=1
|
||||
return 0
|
||||
else
|
||||
_COLOR=
|
||||
__COLOR=0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
@ -120,9 +124,9 @@ printfp() {(
|
|||
fi
|
||||
should_color || true
|
||||
if [ $# -eq 0 ]; then
|
||||
printf '%s' "$(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix")"
|
||||
printf '%s' "$(COLOR=$__COLOR setaf "$FGCOLOR" "$prefix")"
|
||||
else
|
||||
printf '%s: %s\n' "$(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix")" "$(printf "$@")"
|
||||
printf '%s: %s\n' "$(COLOR=$__COLOR setaf "$FGCOLOR" "$prefix")" "$(printf "$@")"
|
||||
fi
|
||||
)}
|
||||
|
||||
|
|
@ -131,7 +135,7 @@ catp() {
|
|||
shift
|
||||
|
||||
should_color || true
|
||||
sed "s/^/$(COLOR=${_COLOR-} printfp "$prefix" '')/"
|
||||
sed "s/^/$(COLOR=$__COLOR printfp "$prefix" '')/"
|
||||
}
|
||||
|
||||
repeat() {
|
||||
|
|
@ -158,17 +162,17 @@ printferr() {
|
|||
|
||||
logp() {
|
||||
should_color >&2 || true
|
||||
COLOR=${_COLOR-} echop "$@" | humanpath >&2
|
||||
COLOR=$__COLOR echop "$@" | humanpath >&2
|
||||
}
|
||||
|
||||
logfp() {
|
||||
should_color >&2 || true
|
||||
COLOR=${_COLOR-} printfp "$@" | humanpath >&2
|
||||
COLOR=$__COLOR printfp "$@" | humanpath >&2
|
||||
}
|
||||
|
||||
logpcat() {
|
||||
should_color >&2 || true
|
||||
COLOR=${_COLOR-} catp "$@" | humanpath >&2
|
||||
COLOR=$__COLOR catp "$@" | humanpath >&2
|
||||
}
|
||||
|
||||
log() {
|
||||
|
|
@ -293,6 +297,13 @@ runtty() {
|
|||
return 1
|
||||
esac
|
||||
}
|
||||
|
||||
capcode() {
|
||||
set +e
|
||||
"$@"
|
||||
code=$?
|
||||
set -e
|
||||
}
|
||||
#!/bin/sh
|
||||
if [ "${LIB_FLAG-}" ]; then
|
||||
return 0
|
||||
|
|
|
|||
4
make.sh
4
make.sh
|
|
@ -1,7 +1,9 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
if [ ! -d "$(dirname "$0")/ci/sub/.git" ]; then
|
||||
if [ ! -e "$(dirname "$0")/ci/sub/.git" ]; then
|
||||
set -x
|
||||
git submodule update --init
|
||||
set +x
|
||||
fi
|
||||
. "$(dirname "$0")/ci/sub/lib.sh"
|
||||
PATH="$(cd -- "$(dirname "$0")" && pwd)/ci/sub/bin:$PATH"
|
||||
|
|
|
|||
Loading…
Reference in a new issue