diff --git a/gitstatus/build b/gitstatus/build index ad39910ac..05b3abc58 100755 --- a/gitstatus/build +++ b/gitstatus/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/gitstatus.plugin.sh b/gitstatus/gitstatus.plugin.sh index 0c6609671..37b78f44a 100644 --- a/gitstatus/gitstatus.plugin.sh +++ b/gitstatus/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/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh index 181e756ae..228fea74c 100644 --- a/gitstatus/gitstatus.plugin.zsh +++ b/gitstatus/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/gitstatus/install b/gitstatus/install index a0142b2b3..6e027a3bf 100755 --- a/gitstatus/install +++ b/gitstatus/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