ci/release: DRYRUN -> DRY_RUN
This commit is contained in:
parent
ca336e8fcf
commit
2eff0d4caa
4 changed files with 89 additions and 10 deletions
|
|
@ -7,7 +7,7 @@ tag="$(sh_c docker build \
|
||||||
--build-arg GOVERSION="1.19.3.linux-$ARCH" \
|
--build-arg GOVERSION="1.19.3.linux-$ARCH" \
|
||||||
-qf ./ci/release/builders/Dockerfile ./ci/release/builders)"
|
-qf ./ci/release/builders/Dockerfile ./ci/release/builders)"
|
||||||
docker_run \
|
docker_run \
|
||||||
-e DRYRUN \
|
-e DRY_RUN \
|
||||||
-e HW_BUILD_DIR \
|
-e HW_BUILD_DIR \
|
||||||
-e VERSION \
|
-e VERSION \
|
||||||
-e OS \
|
-e OS \
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ version: $VERSION
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
\`\`\`sh
|
\`\`\`sh
|
||||||
make install PREFIX=/usr/local DRYRUN=1
|
make install PREFIX=/usr/local DRY_RUN=1
|
||||||
# If it looks right, run:
|
# If it looks right, run:
|
||||||
make install PREFIX=/usr/local
|
make install PREFIX=/usr/local
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
@ -19,7 +19,7 @@ make install PREFIX=/usr/local
|
||||||
## Uninstall
|
## Uninstall
|
||||||
|
|
||||||
\`\`\`sh
|
\`\`\`sh
|
||||||
make uninstall PREFIX=/usr/local DRYRUN=1
|
make uninstall PREFIX=/usr/local DRY_RUN=1
|
||||||
# If it looks right, run:
|
# If it looks right, run:
|
||||||
make uninstall PREFIX=/usr/local
|
make uninstall PREFIX=/usr/local
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ logcat() {
|
||||||
|
|
||||||
sh_c() {
|
sh_c() {
|
||||||
COLOR=3 logp exec "$*"
|
COLOR=3 logp exec "$*"
|
||||||
if [ -z "${DRYRUN-}" ]; then
|
if [ -z "${DRY_RUN-}" ]; then
|
||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
91
install.sh
91
install.sh
|
|
@ -162,7 +162,7 @@ warnf() {
|
||||||
|
|
||||||
sh_c() {
|
sh_c() {
|
||||||
COLOR=3 logp exec "$*"
|
COLOR=3 logp exec "$*"
|
||||||
if [ -z "${DRYRUN-}" ]; then
|
if [ -z "${DRY_RUN-}" ]; then
|
||||||
eval "$@"
|
eval "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -271,9 +271,9 @@ flag_parse() {
|
||||||
-*=*)
|
-*=*)
|
||||||
# Remove everything after first equal sign.
|
# Remove everything after first equal sign.
|
||||||
FLAG="${1%%=*}"
|
FLAG="${1%%=*}"
|
||||||
FLAGRAW="$FLAG"
|
|
||||||
# Remove leading hyphens.
|
# Remove leading hyphens.
|
||||||
FLAG="${FLAG#-}"; FLAG="${FLAG#-}"
|
FLAG="${FLAG#-}"; FLAG="${FLAG#-}"
|
||||||
|
FLAGRAW="$(flag_fmt)"
|
||||||
# Remove everything before first equal sign.
|
# Remove everything before first equal sign.
|
||||||
FLAGARG="${1#*=}"
|
FLAGARG="${1#*=}"
|
||||||
FLAGSHIFT=1
|
FLAGSHIFT=1
|
||||||
|
|
@ -293,7 +293,7 @@ flag_parse() {
|
||||||
-*)
|
-*)
|
||||||
# Remove leading hyphens.
|
# Remove leading hyphens.
|
||||||
FLAG="${1#-}"; FLAG="${FLAG#-}"
|
FLAG="${1#-}"; FLAG="${FLAG#-}"
|
||||||
FLAGRAW=$1
|
FLAGRAW=$(flag_fmt)
|
||||||
unset FLAGARG
|
unset FLAGARG
|
||||||
FLAGSHIFT=1
|
FLAGSHIFT=1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
|
@ -351,6 +351,14 @@ Run with --help for usage.
|
||||||
EOF
|
EOF
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag_fmt() {
|
||||||
|
if [ "$(printf %s "$FLAG" | wc -c)" -eq 1 ]; then
|
||||||
|
echo "-$FLAG"
|
||||||
|
else
|
||||||
|
echo "--$FLAG"
|
||||||
|
fi
|
||||||
|
}
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
|
@ -362,7 +370,7 @@ help() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
usage: $arg0 [--dryrun] [--version vX.X.X] [--edge] [--method detect] [--prefix ~/.local]
|
usage: $arg0 [--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix ~/.local]
|
||||||
[--tala] [--tala-version vX.X.X] [--force] [--uninstall]
|
[--tala] [--tala-version vX.X.X] [--force] [--uninstall]
|
||||||
|
|
||||||
install.sh automates the installation of D2 onto your system. It currently only supports
|
install.sh automates the installation of D2 onto your system. It currently only supports
|
||||||
|
|
@ -371,15 +379,20 @@ source, build a release and install from it.
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
|
|
||||||
--dryrun
|
--dry-run
|
||||||
Pass to have install.sh show the install method and flags that will be used to install
|
Pass to have install.sh show the install method and flags that will be used to install
|
||||||
without executing them. Very useful to understand what changes it will make to your system.
|
without executing them. Very useful to understand what changes it will make to your system.
|
||||||
|
|
||||||
--version vX.X.X
|
--version vX.X.X
|
||||||
Pass to have install.sh install the given version instead of the latest version.
|
Pass to have install.sh install the given version instead of the latest version.
|
||||||
|
note: currently unimplemented.
|
||||||
|
|
||||||
--edge
|
--edge
|
||||||
Pass to build and install D2 from source.
|
Pass to build and install D2 from source. This will still use --method if set to detect
|
||||||
|
to install the release archive for your OS, whether it's apt, yum, brew or standalone
|
||||||
|
if an unsupported package manager is used. To install from source like a dev would,
|
||||||
|
use go install oss.terrastruct.com/d2
|
||||||
|
note: currently unimplemented.
|
||||||
|
|
||||||
--method [detect | standalone]
|
--method [detect | standalone]
|
||||||
Pass to control the method by which to install. Right now we only support standalone
|
Pass to control the method by which to install. Right now we only support standalone
|
||||||
|
|
@ -404,6 +417,7 @@ Flags:
|
||||||
|
|
||||||
--tala-version vX.X.X
|
--tala-version vX.X.X
|
||||||
Install the passed version of tala instead of latest.
|
Install the passed version of tala instead of latest.
|
||||||
|
note: currently unimplemented.
|
||||||
|
|
||||||
--force:
|
--force:
|
||||||
Force installation over the existing version even if they match. It will attempt a clean
|
Force installation over the existing version even if they match. It will attempt a clean
|
||||||
|
|
@ -423,3 +437,68 @@ You can rerun install.sh to update your version of D2. install.sh will avoid rei
|
||||||
if the installed version is the latest unless --force is passed.
|
if the installed version is the latest unless --force is passed.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
while :; do
|
||||||
|
flag_parse "$@"
|
||||||
|
case "$FLAG" in
|
||||||
|
h|help)
|
||||||
|
help
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
dry-run)
|
||||||
|
flag_noarg && shift "$FLAGSHIFT"
|
||||||
|
DRY_RUN=1
|
||||||
|
;;
|
||||||
|
version)
|
||||||
|
flag_nonemptyarg && shift "$FLAGSHIFT"
|
||||||
|
VERSION=$FLAGARG
|
||||||
|
echoerr "$FLAGRAW is currently unimplemented"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
tala-version)
|
||||||
|
flag_nonemptyarg && shift "$FLAGSHIFT"
|
||||||
|
TALA_VERSION=$FLAGARG
|
||||||
|
echoerr "$FLAGRAW is currently unimplemented"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
edge)
|
||||||
|
flag_noarg && shift "$FLAGSHIFT"
|
||||||
|
EDGE=1
|
||||||
|
echoerr "$FLAGRAW is currently unimplemented"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
method)
|
||||||
|
flag_nonemptyarg && shift "$FLAGSHIFT"
|
||||||
|
METHOD=$FLAGARG
|
||||||
|
echoerr "$FLAGRAW is currently unimplemented"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
prefix)
|
||||||
|
flag_nonemptyarg && shift "$FLAGSHIFT"
|
||||||
|
export PREFIX=$FLAGARG
|
||||||
|
;;
|
||||||
|
force)
|
||||||
|
flag_noarg && shift "$FLAGSHIFT"
|
||||||
|
FORCE=1
|
||||||
|
;;
|
||||||
|
uninstall)
|
||||||
|
flag_noarg && shift "$FLAGSHIFT"
|
||||||
|
UNINSTALL=1
|
||||||
|
;;
|
||||||
|
'')
|
||||||
|
shift "$FLAGSHIFT"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
flag_errusage "unrecognized flag $FLAGRAW"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
flag_errusage "no arguments are accepted"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue