From aaa14185197b8b70c47a0b5a1c7d9aa74a073fed Mon Sep 17 00:00:00 2001 From: aarondill Date: Wed, 5 Jul 2023 13:16:06 -0500 Subject: [PATCH] ensure _man_dir/man1/ folder exists before copy This fixes a logic error, where `$_man_dir` is checked to ensure it exists, but not the `man1` subdirectory. It feels most reasonable to ensure the selected mandir exists, but not that the file structure of the directory is user-managed. --- install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index fa02d61..4b54df8 100755 --- a/install.sh +++ b/install.sh @@ -149,7 +149,12 @@ main() { # Install manpages. # shellcheck disable=SC2086 # The lack of quoting is intentional. - ensure ${_sudo} cp "man/man1/"* "${_man_dir}/man1/" + { + if ! [ -d "${_man_dir}/man1/" ]; then + ensure ${_sudo} mkdir -p "${_man_dir}/man1/" + fi + ensure ${_sudo} cp "man/man1/"* "${_man_dir}/man1/" + } log "Installed manpages to ${_man_dir}" # Print success message and check $PATH.