summaryrefslogtreecommitdiffhomepage
path: root/tools/setup-unit
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@nginx.com>2022-12-16 21:39:28 +0100
committerAlejandro Colomar <alx@nginx.com>2023-01-02 22:44:18 +0100
commit2435bd1c3a55cad4d9bcacf5389a38c7cb0b154e (patch)
tree3ba6148100cee905afac7ae331be198baad291ac /tools/setup-unit
parent6861c25e4e46a9ee34f2f80ce468f846403046a1 (diff)
downloadunit-2435bd1c3a55cad4d9bcacf5389a38c7cb0b154e.tar.gz
unit-2435bd1c3a55cad4d9bcacf5389a38c7cb0b154e.tar.bz2
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>
Diffstat (limited to 'tools/setup-unit')
-rwxr-xr-xtools/setup-unit5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/setup-unit b/tools/setup-unit
index a41b7f81..d16fe1a3 100755
--- a/tools/setup-unit
+++ b/tools/setup-unit
@@ -562,6 +562,9 @@ unit_ctl_welcome()
www='/srv/www/unit/index.html';
if test -e "$www" && ! test -v force || ! test -w /srv; then
+ www="$HOME/srv/www/unit/index.html";
+ fi;
+ if test -e "$www" && ! test -v force; then
www="$(mktemp)";
mv "$www" "$www.html";
www="$www.html"
@@ -624,7 +627,7 @@ unit_ctl_welcome()
dry_run_echo 'Create a file to serve:';
dry_run_eval "mkdir -p $(dirname $www);";
- dry_run_eval "cat >'$www'"' <<__EOF__;
+ dry_run_eval "tee '$www' >/dev/null"' <<__EOF__;
<!DOCTYPE html>
<html>
<head>