8000 Clarify default install directory behaviour by aknoerig · Pull Request #1912 · replicate/cog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Clarify default install directory behaviour #1912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
# SOFTWARE.
set -e

set_install_dir() {
# Set install directory
DEFAULT_INSTALL_DIR="/usr/local/bin"
if [ -z "${INSTALL_DIR}" ]; then
read -p "Install location? [$DEFAULT_INSTALL_DIR]: " INSTALL_DIR
INSTALL_DIR=${INSTALL_DIR:-$DEFAULT_INSTALL_DIR}
fi
if [ ! -d "$INSTALL_DIR" ]; then
echo "The directory $INSTALL_DIR does not exist. Please create it and re-run this script."
# Ask user to manually create directory rather than making it for them,
# so they don't just type in "y" again and accidentally install at ./y
exit 1
fi
# Expand abbreviations in INSTALL_DIR
INSTALL_DIR=$(cd "$INSTALL_DIR"; pwd)
}

command_exists() {
command -v "$@" >/dev/null 2>&1
Expand Down Expand Up @@ -150,18 +166,7 @@ main() {
esac
fi

# Set install directory
if [ -z "${INSTALL_DIR}" ]; then
read -p "Install location? [/usr/local/bin]: " INSTALL_DIR
fi
if [ ! -d "$INSTALL_DIR" ]; then
echo "The directory $INSTALL_DIR does not exist. Please create it and re-run this script."
# Ask user to manually create directory rather than making it for them,
# so they don't just type in "y" again and accidentally install at ./y
exit 1
fi
# Expand abbreviations in INSTALL_DIR
INSTALL_DIR=$(cd "$INSTALL_DIR"; pwd)
set_install_dir

# Check if `cog` command already exists
if command_exists cog; then
Expand Down
0