diff --git a/build b/build index ad39910..05b3abc 100755 --- a/build +++ b/build @@ -145,8 +145,12 @@ cpus="$(command getconf _NPROCESSORS_ONLN 2>/dev/null)" || cpus=8 case "$gitstatus_cpu" in - powerpc64le) archflag="-mcpu";; - *) archflag="-march";; + powerpc64|powerpc64le) + archflag="-mcpu" + ;; + *) + archflag="-march" + ;; esac cflags="$archflag=$gitstatus_cpu -fno-plt -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fpie" @@ -520,7 +524,7 @@ if [ -z "$gitstatus_cpu" ]; then armv6l|armhf) gitstatus_cpu=armv6;; armv7l) gitstatus_cpu=armv7;; arm64|aarch64) gitstatus_cpu=armv8-a;; - ppc64le) gitstatus_cpu=powerpc64le;; + ppc64|ppc64le) gitstatus_cpu=powerpc64le;; riscv64) gitstatus_cpu=rv64imafdc;; loongarch64) gitstatus_cpu=loongarch64;; x86_64|amd64) gitstatus_cpu=x86-64;; @@ -559,7 +563,7 @@ case "$gitstatus_kernel" in armv6l|armhf) docker_image=arm32v6/alpine:3.11.6;; armv7l) docker_image=arm32v7/alpine:3.11.6;; aarch64) docker_image=arm64v8/alpine:3.11.6;; - ppc64le) docker_image=ppc64le/alpine:3.11.6;; + ppc64|ppc64le) docker_image=ppc64le/alpine:3.11.6;; s390x) docker_image=s390x/alpine:3.11.6;; *) >&2 echo '[error] unable to infer docker image' diff --git a/gitstatus.plugin.sh b/gitstatus.plugin.sh index 0c66096..37b78f4 100644 --- a/gitstatus.plugin.sh +++ b/gitstatus.plugin.sh @@ -121,7 +121,12 @@ function gitstatus_start() { --repo-ttl-seconds="$ttl" $extra_flags) - tmpdir="$(command mktemp -d "${TMPDIR:-/tmp}"/gitstatus.bash.$$.XXXXXXXXXX)" || return + if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then + local tmpdir=$TMPDIR + else + local tmpdir=/tmp + fi + tmpdir="$(command mktemp -d "$tmpdir"/gitstatus.bash.$$.XXXXXXXXXX)" || return if [[ -n "$log_level" ]]; then GITSTATUS_DAEMON_LOG="$tmpdir"/daemon.log diff --git a/gitstatus.plugin.zsh b/gitstatus.plugin.zsh index 181e756..228fea7 100644 --- a/gitstatus.plugin.zsh +++ b/gitstatus.plugin.zsh @@ -574,7 +574,12 @@ function gitstatus_start"${1:-}"() { else typeset -gi _GITSTATUS_START_COUNTER local log_level=$GITSTATUS_LOG_LEVEL - local file_prefix=${${TMPDIR:-/tmp}:A}/gitstatus.$name.$EUID + if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then + local tmpdir=$TMPDIR + else + local tmpdir=/tmp + fi + local file_prefix=${tmpdir:A}/gitstatus.$name.$EUID file_prefix+=.$sysparams[pid].$EPOCHSECONDS.$((++_GITSTATUS_START_COUNTER)) (( GITSTATUS_ENABLE_LOGGING )) && : ${log_level:=INFO} if [[ -n $log_level ]]; then diff --git a/install b/install index a0142b2..6e027a3 100755 --- a/install +++ b/install @@ -245,27 +245,30 @@ END return 1 fi - local tmpdir + if [ -n "$TMPDIR" -a '(' '(' -d "$TMPDIR" -a -w "$TMPDIR" ')' -o '!' '(' -d /tmp -a -w /tmp ')' ')' ]; then + local tmp="$TMPDIR" + else + local tmp=/tmp + fi if ! command -v mktemp >/dev/null 2>&1 || - ! tmpdir="$(command mktemp -d "${TMPDIR:-/tmp}"/gitstatus-install.XXXXXXXXXX)"; then - tmpdir="${TMPDIR:-/tmp}/gitstatus-install.tmp.$$" + ! tmpdir="$(command mktemp -d "$tmp"/gitstatus-install.XXXXXXXXXX)"; then + tmpdir="$tmp/gitstatus-install.tmp.$$" if ! mkdir -p -- "$tmpdir"; then - local dir="${TMPDIR:-/tmp}" - if [ -z "${TMPDIR:-}" ]; then + if [ "$tmp" = /tmp ]; then local label='directory' else local label='directory (\033[1mTMPDIR\033[m)' fi - if [ ! -e "$dir" ]; then - >&"$e" printf 'Temporary '"$label"' does not exist: \033[4;31m%s\033[0m\n' "$dir" + if [ ! -e "$tmp" ]; then + >&"$e" printf 'Temporary '"$label"' does not exist: \033[4;31m%s\033[0m\n' "$tmp" >&"$e" printf '\n' >&"$e" printf 'Create it, then restart your shell.\n' - elif [ ! -d "$dir" ]; then - >&"$e" printf 'Not a '"$label"': \033[4;31m%s\033[0m\n' "$dir" + elif [ ! -d "$tmp" ]; then + >&"$e" printf 'Not a '"$label"': \033[4;31m%s\033[0m\n' "$tmp" >&"$e" printf '\n' >&"$e" printf 'Make it a directory, then restart your shell.\n' - elif [ ! -w "$dir" ]; then - >&"$e" printf 'Temporary '"$label"' is not writable: \033[4;31m%s\033[0m\n' "$dir" + elif [ ! -w "$tmp" ]; then + >&"$e" printf 'Temporary '"$label"' is not writable: \033[4;31m%s\033[0m\n' "$tmp" >&"$e" printf '\n' >&"$e" printf 'Make it writable, then restart your shell.\n' fi