From 854b4e7260f7932f5a4ff72faea85c5875ddc360 Mon Sep 17 00:00:00 2001 From: Orestis <orestis.malaspinas@pm.me> Date: Fri, 21 Feb 2025 16:17:04 +0100 Subject: [PATCH] added destination dir creation --- installer.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/installer.sh b/installer.sh index f4b89e7..8ed1dbf 100644 --- a/installer.sh +++ b/installer.sh @@ -106,20 +106,24 @@ expand_tilde() { } parse_args() { - dest='~/.local/bin' - [ "$OS" = "macos" ] && dest="/usr/local/bin" + destdir='~/.local/bin' + [ "$OS" = "macos" ] && destdir="/usr/local/bin" installer='' while :; do - case "$1" in - dest=*) dest="${1#*=}";; - installer=*) installer="${1#*=}";; - "") break;; - *) die "Unrecognized command line option: $1";; - esac - shift + case "$1" in + destdir=*) destdir="${1#*=}" ;; + installer=*) installer="${1#*=}" ;; + "") break ;; + *) die "Unrecognized command line option: $1" ;; + esac + shift done - dest=$(expand_tilde "${dest}") - dest="$dest/dojo" + destdir=$(expand_tilde "${destdir}") + if [ ! -d "$destdir" ]; then + printf "Directory %s does not exist. Creatring %s now.\n" "$destdir" "$destdir" + mkdir -p "$destdir" + fi + dest="$destdir/dojo" } -- GitLab