File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -465,9 +465,20 @@ install_from_bindist() {
465465 fi
466466 STACK_TEMP_EXE=" $STACK_TEMP_DIR /$( basename " $DEST " ) "
467467 mv " $STACK_TEMP_DIR /$1 " /* /stack " $STACK_TEMP_EXE "
468+ destdir=" $( dirname " $DEST " ) "
469+ if [ ! -d " $destdir " ]; then
470+ info " $destdir directory does not exist; creating it..."
471+ # First try to create directory as current user, then try with sudo if it fails.
472+ if ! mkdir -p " $destdir " 2> /dev/null; then
473+ if ! sudocmd mkdir -p " $destdir " ; then
474+ die " Could not create directory: $DEST "
475+ fi
476+ fi
477+ fi
468478 # First attempt to install 'stack' as current user, then try with sudo if it fails
469- if ! install -c -m 0755 " $STACK_TEMP_EXE " " $( dirname " $DEST " ) " 2> /dev/null; then
470- if ! sudocmd install -c -o 0 -g 0 -m 0755 " $STACK_TEMP_EXE " " $( dirname " $DEST " ) " ; then
479+ info " Installing Stack to: $DEST ..."
480+ if ! install -c -m 0755 " $STACK_TEMP_EXE " " $destdir " 2> /dev/null; then
481+ if ! sudocmd install -c -o 0 -g 0 -m 0755 " $STACK_TEMP_EXE " " $destdir " ; then
471482 die " Install to $DEST failed"
472483 fi
473484 fi
You can’t perform that action at this time.
0 commit comments