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

View File

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