Skip to content

Commit 2435bd1

Browse files
Tools: setup-unit: workarounded macOS tmp file permissions.
mktemp(1) in macOS uses a weird directory where only the running user has permissions. If we use that for the welcome website, unitd(8) won't be able to read the page. Use a directory at $HOME before trying a tmpdir. Reported-by: Liam Crilly <lcrilly@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
1 parent 6861c25 commit 2435bd1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/setup-unit

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ unit_ctl_welcome()
562562

563563
www='/srv/www/unit/index.html';
564564
if test -e "$www" && ! test -v force || ! test -w /srv; then
565+
www="$HOME/srv/www/unit/index.html";
566+
fi;
567+
if test -e "$www" && ! test -v force; then
565568
www="$(mktemp)";
566569
mv "$www" "$www.html";
567570
www="$www.html"
@@ -624,7 +627,7 @@ unit_ctl_welcome()
624627

625628
dry_run_echo 'Create a file to serve:';
626629
dry_run_eval "mkdir -p $(dirname $www);";
627-
dry_run_eval "cat >'$www'"' <<__EOF__;
630+
dry_run_eval "tee '$www' >/dev/null"' <<__EOF__;
628631
<!DOCTYPE html>
629632
<html>
630633
<head>

0 commit comments

Comments
 (0)