mirror of
https://github.com/dani-garcia/bw_web_builds.git
synced 2024-12-26 04:18:15 +03:00
Make scripts compatible with macOS/BSD
All the scripts used by this repo were more focused on Linux based systems. They did not work on macOS or other BSD based systems because of flags or commands which are not available. This PR resolves those items by adjusting the failed commands so they work on both Linux and macOS/BSD systems. Fixes #112
This commit is contained in:
parent
cffdfb06f9
commit
34c0540ec9
8 changed files with 18 additions and 12 deletions
|
@ -53,7 +53,7 @@ WORKDIR /vault/apps/web
|
|||
RUN npm run dist:oss:selfhost
|
||||
|
||||
RUN printf '{"version":"%s"}' \
|
||||
$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | sed -E 's#.*?refs/tags/v##') \
|
||||
$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | grep -Eo '[^\/]*$') \
|
||||
> build/vw-version.json
|
||||
|
||||
# Delete debugging map files, optional
|
||||
|
|
|
@ -10,7 +10,7 @@ if [[ -z ${PATCH_NAME} ]]; then
|
|||
else
|
||||
echo "Patch file not found, using latest"
|
||||
# If not, use the latest one
|
||||
PATCH_NAME="$(find ../patches -printf "%f\\n" | sort -V | tail -n1)"
|
||||
PATCH_NAME="$(find ../patches -type f -print0 | xargs -0 basename -a | sort -V | tail -n1)"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail -o errexit
|
||||
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
||||
|
||||
# Error handling
|
||||
handle_error() {
|
||||
|
@ -30,7 +30,7 @@ npm run dist:oss:selfhost
|
|||
|
||||
# Create vw-version.json with the latest tag from the remote repo.
|
||||
printf '{"version":"%s"}' \
|
||||
"$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | sed -E 's#.*?refs/tags/v##')" \
|
||||
"$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | grep -Eo '[^\/]*$')" \
|
||||
> build/vw-version.json
|
||||
|
||||
popd
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail -o errexit
|
||||
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
||||
|
||||
# Error handling
|
||||
handle_error() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail -o errexit
|
||||
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
||||
|
||||
# Error handling
|
||||
handle_error() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail -o errexit
|
||||
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
||||
|
||||
handle_error() {
|
||||
read -n1 -r -p "FAILED: line $1, exit code $2. Press any key to exit..." _
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail -o errexit
|
||||
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
||||
|
||||
# Error handling
|
||||
handle_error() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o pipefail -o errexit
|
||||
BASEDIR=$(dirname "$(readlink -f "$0")")
|
||||
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
||||
|
||||
# Error handling
|
||||
handle_error() {
|
||||
|
@ -24,7 +24,7 @@ DATE_FORMAT="${DATE_FORMAT:-%Y-%m-%dT%H:%M:%S%z}"
|
|||
# Preserve previous output
|
||||
if [[ -f "${OUTPUT_NAME}.tar.gz" ]];
|
||||
then
|
||||
DATE_SUFFIX=$(date +"${DATE_FORMAT}" -r "${OUTPUT_NAME}.tar.gz")
|
||||
DATE_SUFFIX=$(date -r "${OUTPUT_NAME}.tar.gz" +"${DATE_FORMAT}")
|
||||
mv "${OUTPUT_NAME}.tar.gz" "${OUTPUT_NAME}_${DATE_SUFFIX}.tar.gz"
|
||||
fi
|
||||
|
||||
|
@ -36,10 +36,16 @@ fi
|
|||
|
||||
mv build web-vault
|
||||
# Tar the web-vault
|
||||
tar -czvf "${OUTPUT_NAME}.tar.gz" web-vault --owner=0 --group=0
|
||||
# Check if we are using bsdtar or gnu-tar, bsdtar does not support --owner/--group
|
||||
if [[ "$(tar --version)" =~ .*bsdtar.* ]];
|
||||
then
|
||||
tar -czvf "${OUTPUT_NAME}.tar.gz" web-vault
|
||||
else
|
||||
tar -czvf "${OUTPUT_NAME}.tar.gz" web-vault --owner=0 --group=0
|
||||
fi
|
||||
|
||||
# Copy the web-vault
|
||||
cp -dpr web-vault "${OUTPUT_NAME}"
|
||||
cp -pR web-vault "${OUTPUT_NAME}"
|
||||
mv web-vault build
|
||||
|
||||
popd
|
||||
|
|
Loading…
Reference in a new issue