Detect coreutils with g prefix for macOS brew support.

master
Icedream 2018-07-17 15:22:40 +02:00
parent ff800ae2ae
commit 855e4e8397
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
2 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,10 @@
#!/bin/sh -e
CUT="gcut"
if ! command -v "${READLINK}" 2>&1; then
CUT="cut"
fi
file_changed() {
if [ ! -f "$1" ]; then
if [ ! -f "$2" ]; then
@ -55,7 +60,7 @@ fi
fi
git rev-list --format=oneline "${diffref}" | while IFS= read -r line; do
sha="$(echo "$line" | awk '{print $1}')"
title="$(echo "$line" | cut -f 1 -d ' ' --complement)"
title="$(echo "$line" | "${CUT}" -f 1 -d ' ' --complement)"
printf " … $title\r "
if ! git verify-commit "$sha" >/dev/null 2>&1; then
echo "✘"

View File

@ -1,13 +1,17 @@
#!/bin/sh -e
READLINK="greadlink"
if ! command -v "${READLINK}" 2>&1; then
READLINK="readlink"
fi
install_files() {
target_dir="$1"
source_dir="$(readlink -f "${2:-.}")"
source_dir="$("${READLINK}" -f "${2:-.}")"
target_filename_prefix="${3}"
mkdir -vp "${target_dir}"
target_dir="$(readlink -f "${target_dir}")"
target_dir="$("${READLINK}" -f "${target_dir}")"
if [ ! -d "${source_dir}" ]; then
echo "Source directory ${source_dir} does not exist, skipping."