Skip to content

Commit

Permalink
Merge commit '5014de0541201716dc4ee6f544321ac4e3d7431e'
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Jan 26, 2022
2 parents 6c71862 + 5014de0 commit cead034
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
12 changes: 8 additions & 4 deletions gitstatus/build
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;;
Expand Down Expand Up @@ -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'
Expand Down
7 changes: 6 additions & 1 deletion gitstatus/gitstatus.plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion gitstatus/gitstatus.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions gitstatus/install
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cead034

Please sign in to comment.